Difference between revisions of "TWinsock2TCPSocket"
From Ultibo.org
| Line 84: | Line 84: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
| − | | <code>function ReadFromSocket(AData:Pointer; ASize:Integer):LongInt;</code> | + | | <code>function ReadFromSocket(AData:Pointer; ASize:Integer):LongInt; virtual;</code> |
| | | | ||
|- | |- | ||
| − | | <code>function WriteToSocket(AData:Pointer; ASize:Integer):LongInt;</code> | + | | <code>function WriteToSocket(AData:Pointer; ASize:Integer):LongInt; virtual;</code> |
| | | | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
| − | | <code>function ReadFromSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean; AWait:Boolean; ATimeout:Integer):LongInt;</code> | + | | <code>function ReadFromSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean; AWait:Boolean; ATimeout:Integer):LongInt; virtual;</code> |
| | | | ||
|- | |- | ||
| − | | <code>function WriteToSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; AWait:Boolean; ATimeout:Integer):LongInt;</code> | + | | <code>function WriteToSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; AWait:Boolean; ATimeout:Integer):LongInt; virtual;</code> |
| | | | ||
|- | |- | ||
| Line 119: | Line 119: | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
| − | | <code>function ReadData(AData:Pointer; ACount:Integer):Boolean;</code> | + | | <code>function ReadData(AData:Pointer; ACount:Integer):Boolean; virtual;</code> |
| | | | ||
|- | |- | ||
| − | | <code>function WriteData(AData:Pointer; ACount:Integer):Boolean;</code> | + | | <code>function WriteData(AData:Pointer; ACount:Integer):Boolean; virtual;</code> |
| | | | ||
|- | |- | ||
|colspan="2"| | |colspan="2"| | ||
|- | |- | ||
| − | | <code>function ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean;</code> | + | | <code>function ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean; virtual;</code> |
| | | | ||
|- | |- | ||
| Line 308: | Line 308: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.ReadData(AData:Pointer; ACount:Integer):Boolean;</pre> | <pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.ReadData(AData:Pointer; ACount:Integer):Boolean;</pre> | ||
| − | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read data from the TCP stream socket associated with this object</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
| + | |- | ||
| + | ! Data | ||
| + | | A pointer to a buffer to receive the data | ||
| + | |- | ||
| + | ! Count | ||
| + | | The number of bytes to read | ||
| + | |- | ||
| + | ! Return | ||
| + | | True if the data was read successfully or False on error | ||
|- | |- | ||
! Note | ! Note | ||
| − | | | + | | This function will not return until Count bytes has been read or an error occurs |
|- | |- | ||
|} | |} | ||
| Line 320: | Line 329: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.WriteData(AData:Pointer; ACount:Integer):Boolean;</pre> | <pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.WriteData(AData:Pointer; ACount:Integer):Boolean;</pre> | ||
| − | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write data to the TCP stream socket associated with this object</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
| + | |- | ||
| + | ! Data | ||
| + | | A pointer to a buffer containing the data to write | ||
| + | |- | ||
| + | ! Count | ||
| + | | The number of bytes to be written | ||
| + | |- | ||
| + | ! Return | ||
| + | | True if the data was written successfully or False on error | ||
|- | |- | ||
! Note | ! Note | ||
| − | | | + | | This function will not return until Count bytes has been written or an error occurs |
|- | |- | ||
|} | |} | ||
| Line 332: | Line 350: | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
<pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean;</pre> | <pre style="border: 0; padding-bottom:0px;">function TWinsock2TCPSocket.ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean;</pre> | ||
| − | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' | + | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Read all available data from the TCP stream socket associated with this object</div> |
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
| + | |- | ||
| + | ! Data | ||
| + | | A pointer to a buffer to receive the data | ||
| + | |- | ||
| + | ! Size | ||
| + | | The size in bytes of the buffer | ||
| + | |- | ||
| + | ! Count | ||
| + | | On return the total number of bytes read, may be less than Size if socket has been Closed | ||
| + | |- | ||
| + | ! Closed | ||
| + | | On return True if the socket has been closed | ||
| + | |- | ||
| + | ! Return | ||
| + | | True if the data was read successfully or False on error | ||
|- | |- | ||
! Note | ! Note | ||
| − | | | + | | This function will not return until Size bytes has been read, the socket is Closed or an error occurs |
|- | |- | ||
|} | |} | ||
Latest revision as of 04:53, 6 November 2025
Return to Unit Winsock2
Description
To be documented
Class definitions
TWinsock2TCPSocket = class(TWinsock2Socket)
| Note: Stream Socket (SOCK_STREAM) classes | |
public
| |
constructor Create;
|
|
private
| |
FUseNagle:Boolean;
|
|
FUseKeepalive:Boolean;
|
|
FSegmentSize:Integer;
|
|
procedure SetSocketType(ASocketType:Integer); override;
|
|
procedure SetProtocol(AProtocol:Integer); override;
|
|
procedure SetBacklog(ABacklog:Integer);
|
|
procedure SetUseNagle(AUseNagle:Boolean);
|
|
procedure SetUseKeepalive(AUseKeepalive:Boolean);
|
|
procedure SetSegmentSize(ASegmentSize:Integer);
|
|
function GetMaxSegmentSize:LongWord;
|
|
procedure SetMaxSegmentSize(AMaxSegmentSize:LongWord);
|
|
protected
| |
FBacklog:Integer;
|
|
FMaxSegmentSize:LongWord;
|
|
function Listen(ABacklog:Integer):LongInt;
|
|
function ReadFromSocket(AData:Pointer; ASize:Integer):LongInt; virtual;
|
|
function WriteToSocket(AData:Pointer; ASize:Integer):LongInt; virtual;
|
|
function ReadFromSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean; AWait:Boolean; ATimeout:Integer):LongInt; virtual;
|
|
function WriteToSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; AWait:Boolean; ATimeout:Integer):LongInt; virtual;
|
|
public
| |
property Backlog:Integer read FBacklog write SetBacklog;
|
|
property UseNagle:Boolean read FUseNagle write SetUseNagle;
|
|
property UseKeepalive:Boolean read FUseKeepalive write SetUseKeepalive;
|
|
property SegmentSize:Integer read FSegmentSize write SetSegmentSize;
|
|
property MaxSegmentSize:LongWord read GetMaxSegmentSize write SetMaxSegmentSize;
|
|
function ReadData(AData:Pointer; ACount:Integer):Boolean; virtual;
|
|
function WriteData(AData:Pointer; ACount:Integer):Boolean; virtual;
|
|
function ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean; virtual;
|
|
Function declarations
constructor TWinsock2TCPSocket.Create;
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetSocketType(ASocketType:Integer);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetProtocol(AProtocol:Integer);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetBacklog(ABacklog:Integer);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetUseNagle(AUseNagle:Boolean);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetUseKeepalive(AUseKeepalive:Boolean);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.SetSegmentSize(ASegmentSize:Integer);
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.GetMaxSegmentSize:LongWord;
Description: To be documented
| Note | None documented |
|---|
procedure TWinsock2TCPSocket.MaxSegmentSize:LongWord read GetMaxSegmentSize write SetMaxSegmentSize;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.Listen(ABacklog:Integer):LongInt;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.ReadFromSocket(AData:Pointer; ASize:Integer):LongInt;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.WriteToSocket(AData:Pointer; ASize:Integer):LongInt;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.ReadFromSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean; AWait:Boolean; ATimeout:Integer):LongInt;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.WriteToSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; AWait:Boolean; ATimeout:Integer):LongInt;
Description: To be documented
| Note | None documented |
|---|
function TWinsock2TCPSocket.ReadData(AData:Pointer; ACount:Integer):Boolean;
Description: Read data from the TCP stream socket associated with this object
| Data | A pointer to a buffer to receive the data |
|---|---|
| Count | The number of bytes to read |
| Return | True if the data was read successfully or False on error |
| Note | This function will not return until Count bytes has been read or an error occurs |
function TWinsock2TCPSocket.WriteData(AData:Pointer; ACount:Integer):Boolean;
Description: Write data to the TCP stream socket associated with this object
| Data | A pointer to a buffer containing the data to write |
|---|---|
| Count | The number of bytes to be written |
| Return | True if the data was written successfully or False on error |
| Note | This function will not return until Count bytes has been written or an error occurs |
function TWinsock2TCPSocket.ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean;
Description: Read all available data from the TCP stream socket associated with this object
| Data | A pointer to a buffer to receive the data |
|---|---|
| Size | The size in bytes of the buffer |
| Count | On return the total number of bytes read, may be less than Size if socket has been Closed |
| Closed | On return True if the socket has been closed |
| Return | True if the data was read successfully or False on error |
| Note | This function will not return until Size bytes has been read, the socket is Closed or an error occurs |
Return to Unit Reference