Difference between revisions of "Unit Winsock2"

From Ultibo.org
Jump to: navigation, search
 
(4 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo Winsock2 interface unit'''
+
'''Ultibo Winsock2 Interface unit'''
  
 
''Notes:''
 
''Notes:''
Line 2,056: Line 2,056:
  
  
'''Winsock2 socket'''
+
'''Base socket classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2Socket = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Base Socket classes
+
| [[TWinsock2Socket|<code>TWinsock2Socket = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FBoundPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FBoundAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FReuseAddress:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFamily(AFamily:Integer); virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetSocketType(ASocketType:Integer); virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProtocol(AProtocol:Integer); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBoundPort(ABoundPort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetBoundAddress(const ABoundAddress:String); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetReuseAddress(AReuseAddress:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetLocalPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>function GetLocalHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetLocalAddress:String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetLocalAddresses:TStrings;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetSendSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetSendSize(ASize:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetReceiveSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetReceiveSize(ASize:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetSendTimeout:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetSendTimeout(ATimeout:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetReceiveTimeout:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetReceiveTimeout(ATimeout:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetConnectTimeout:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetConnectTimeout(ATimeout:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FHandle:TSocket;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FFamily:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FSocketType:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FProtocol:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FLastError:LongInt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetBroadcastAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateFamily:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateAddress(var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateBoundAddress(var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateSocket(ASocketType:Integer):TSocket;</code>
+
| &nbsp;
+
|-
+
| <code>function Bind:LongInt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SockAddrToPort(ASockAddr:PSockAddr; ALength:Integer):Word;</code>
+
| &nbsp;
+
|-
+
| <code>function SockAddrToAddress(ASockAddr:PSockAddr; ALength:Integer):String;</code>
+
| &nbsp;
+
|-
+
| <code>function PortToSockAddr(APort:Word; ASockAddr:PSockAddr; ALength:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function AddressToSockAddr(const AAddress:String; var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Handle:TSocket read FHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Family:Integer read FFamily write SetFamily;</code>
+
| &nbsp;
+
|-
+
| <code>property SocketType:Integer read FSocketType write SetSocketType;</code>
+
| &nbsp;
+
|-
+
| <code>property Protocol:Integer read FProtocol write SetProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property LastError:LongInt read FLastError;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property BoundPort:Word read FBoundPort write SetBoundPort;</code>
+
| &nbsp;
+
|-
+
| <code>property BoundAddress:String read FBoundAddress write SetBoundAddress;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property ReuseAddress:Boolean read FReuseAddress write SetReuseAddress;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property LocalPort:Word read GetLocalPort;</code>
+
| &nbsp;
+
|-
+
| <code>property LocalHost:String read GetLocalHost;</code>
+
| &nbsp;
+
|-
+
| <code>property LocalAddress:String read GetLocalAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property LocalAddresses:TStrings read GetLocalAddresses;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property SendSize:Integer read GetSendSize write SetSendSize;</code>
+
| &nbsp;
+
|-
+
| <code>property ReceiveSize:Integer read GetReceiveSize write SetReceiveSize;</code>
+
| &nbsp;
+
|-
+
| <code>property SendTimeout:Integer read GetSendTimeout write SetSendTimeout;</code>
+
| &nbsp;
+
|-
+
| <code>property ReceiveTimeout:Integer read GetReceiveTimeout write SetReceiveTimeout;</code>
+
| &nbsp;
+
|-
+
| <code>property ConnectTimeout:Integer read GetConnectTimeout write SetConnectTimeout;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Connected:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Shutdown:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Disconnect:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function CloseSocket:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ResolveHost(const AHost:String):String;</code>
+
| &nbsp;
+
|-
+
| <code>function ResolveFamily(const AAddress:String):Integer;</code>
+
| &nbsp;
+
|-
+
| <code>function ResolveAddress(const AAddress:String):String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ResolveHostEx(const AHost:String; AFamily:Integer; AAll:Boolean):TStrings;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 socket thread'''
+
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2SocketThread = class(TThreadEx)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TWinsock2SocketThread|<code>TWinsock2SocketThread = class(TThreadEx)</code>]]
|-
+
| <code>FPrev:TWinsock2SocketThread;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>FNext:TWinsock2SocketThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Prev:TWinsock2SocketThread read FPrev write FPrev;</code>
+
| &nbsp;
+
|-
+
| <code>property Next:TWinsock2SocketThread read FNext write FNext;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 socket threads''' 
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2SocketThreads = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2SocketThreads|<code>TWinsock2SocketThreads = class(TObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FCount:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FFirst:TWinsock2SocketThread;</code>
+
| &nbsp;
+
|-
+
| <code>FLast:TWinsock2SocketThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>function GetFirst:TWinsock2SocketThread;</code>
+
| &nbsp;
+
|-
+
| <code>function GetLast:TWinsock2SocketThread;</code>
+
| &nbsp;
+
|-
+
| <code>function Link(AValue:TWinsock2SocketThread):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function LinkEx(APrev,AValue:TWinsock2SocketThread):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function Unlink(AValue:TWinsock2SocketThread):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Count:Integer read GetCount;</code>
+
| &nbsp;
+
|-
+
| <code>property First:TWinsock2SocketThread read GetFirst;</code>
+
| &nbsp;
+
|-
+
| <code>property Last:TWinsock2SocketThread read GetLast;</code>
+
| &nbsp;
+
|-
+
| <code>function Add(AValue:TWinsock2SocketThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Remove(AValue:TWinsock2SocketThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Insert(APrev,AValue:TWinsock2SocketThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Find(AValue:TWinsock2SocketThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function FindByID(AThreadID:TThreadID):TWinsock2SocketThread; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure Clear; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 socket buffer'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2SocketBuffer = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TWinsock2SocketBuffer|<code>TWinsock2SocketBuffer = class(TObject)</code>]]
|-
+
| <code>FPrev:TWinsock2SocketBuffer;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>FNext:TWinsock2SocketBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Prev:TWinsock2SocketBuffer read FPrev write FPrev;</code>
+
| &nbsp;
+
|-
+
| <code>property Next:TWinsock2SocketBuffer read FNext write FNext;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
+
'''Winsock2 socket buffers'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2SocketBuffers = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2SocketBuffers|<code>TWinsock2SocketBuffers = class(TObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FCount:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FFirst:TWinsock2SocketBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>FLast:TWinsock2SocketBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>function GetFirst:TWinsock2SocketBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>function GetLast:TWinsock2SocketBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>function Link(AValue:TWinsock2SocketBuffer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function LinkEx(APrev,AValue:TWinsock2SocketBuffer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function Unlink(AValue:TWinsock2SocketBuffer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Count:Integer read GetCount;</code>
+
| &nbsp;
+
|-
+
| <code>property First:TWinsock2SocketBuffer read GetFirst;</code>
+
| &nbsp;
+
|-
+
| <code>property Last:TWinsock2SocketBuffer read GetLast;</code>
+
| &nbsp;
+
|-
+
| <code>function Add(AValue:TWinsock2SocketBuffer):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Remove(AValue:TWinsock2SocketBuffer):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Insert(APrev,AValue:TWinsock2SocketBuffer):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Find(AValue:TWinsock2SocketBuffer):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure Clear; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
'''Winsock2 RAW socket'''
 
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
'''Raw socket (SOCK_RAW) classes'''
  
<code>TWinsock2RAWSocket = class(TWinsock2Socket)</code>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Raw Socket (SOCK_RAW) classes
+
| [[TWinsock2RAWSocket|<code>TWinsock2RAWSocket = class(TWinsock2Socket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FBufferSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FBroadcastEnabled:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetSocketType(ASocketType:Integer); override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProtocol(AProtocol:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBufferSize(ABufferSize:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetBroadcastEnabled(ABroadcastEnabled:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function RecvFromSocket(ASockAddr:PSockAddr; ASockLen:PInteger; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendToSocket(ASockAddr:PSockAddr; ASockLen:Integer; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvFromSocketEx(AHandle:THandle; ASockAddr:PSockAddr; ASockLen:PInteger; AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendToSocketEx(AHandle:THandle; ASockAddr:PSockAddr; ASockLen:Integer; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property BufferSize:Integer read FBufferSize write SetBufferSize;</code>
+
| &nbsp;
+
|-
+
| <code>property BroadcastEnabled:Boolean read FBroadcastEnabled write SetBroadcastEnabled;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function BroadcastData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvDataFrom(var AHost:String; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDataTo(const AHost:String; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function BroadcastDataTo(const AAddress:String; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 TCP socket'''
+
'''Stream socket (SOCK_STREAM) classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2TCPSocket = class(TWinsock2Socket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Stream Socket (SOCK_STREAM) classes
+
| [[TWinsock2TCPSocket|<code>TWinsock2TCPSocket = class(TWinsock2Socket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FUseNagle:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FUseKeepalive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FSegmentSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FMaxSegmentSize:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetSocketType(ASocketType:Integer); override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProtocol(AProtocol:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBacklog(ABacklog:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetUseNagle(AUseNagle:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetUseKeepalive(AUseKeepalive:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetSegmentSize(ASegmentSize:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMaxSegmentSize(AMaxSegmentSize:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FBacklog:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Listen(ABacklog:Integer):LongInt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadFromSocket(AData:Pointer; ASize:Integer):LongInt;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteToSocket(AData:Pointer; ASize:Integer):LongInt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadFromSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean; AWait:Boolean; ATimeout:Integer):LongInt;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteToSocketEx(AData:Pointer; ASize:Integer; var ACount:Integer; AWait:Boolean; ATimeout:Integer):LongInt;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Backlog:Integer read FBacklog write SetBacklog;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property UseNagle:Boolean read FUseNagle write SetUseNagle;</code>
+
| &nbsp;
+
|-
+
| <code>property UseKeepalive:Boolean read FUseKeepalive write SetUseKeepalive;</code>
+
| &nbsp;
+
|-
+
| <code>property SegmentSize:Integer read FSegmentSize write SetSegmentSize;</code>
+
| &nbsp;
+
|-
+
| <code>property MaxSegmentSize:LongWord read FMaxSegmentSize write SetMaxSegmentSize;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadData(AData:Pointer; ACount:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteData(AData:Pointer; ACount:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadAvailable(AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
'''Winsock2 UDP socket'''
 
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
'''Datagram socket (SOCK_DGRAM) classes'''
  
<code>TWinsock2UDPSocket = class(TWinsock2Socket)</code>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Datagram Socket (SOCK_DGRAM) classes
+
| [[TWinsock2UDPSocket|<code>TWinsock2UDPSocket = class(TWinsock2Socket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FBufferSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FBroadcastEnabled:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetSocketType(ASocketType:Integer); override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetProtocol(AProtocol:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBufferSize(ABufferSize:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetBroadcastEnabled(ABroadcastEnabled:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function RecvFromSocket(ASockAddr:PSockAddr; ASockLen:PInteger; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendToSocket(ASockAddr:PSockAddr; ASockLen:Integer; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvFromSocketEx(AHandle:THandle; ASockAddr:PSockAddr; ASockLen:PInteger; AData:Pointer; ASize:Integer; var ACount:Integer; var AClosed:Boolean):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendToSocketEx(AHandle:THandle; ASockAddr:PSockAddr; ASockLen:Integer; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property BufferSize:Integer read FBufferSize write SetBufferSize;</code>
+
| &nbsp;
+
|-
+
| <code>property BroadcastEnabled:Boolean read FBroadcastEnabled write SetBroadcastEnabled;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function BroadcastData(AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function RecvDataFrom(var AHost:String; var APort:Word; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendDataTo(const AHost:String; APort:Word; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function BroadcastDataTo(const AAddress:String; APort:Word; AData:Pointer; ACount:Integer):Integer; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 RAW client'''
+
'''Raw client classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2RAWClient = class(TWinsock2RAWSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Raw Client classes
+
| [[TWinsock2RAWClient|<code>TWinsock2RAWClient = class(TWinsock2RAWSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FUseConnect:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FRemoteHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetUseConnect(AUseConnect:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFamily(AFamily:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBoundAddress(const ABoundAddress:String); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetRemoteHost(const ARemoteHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteAddress(const ARemoteAddress:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AllocateFamily:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateRemoteAddress(var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property UseConnect:Boolean read FUseConnect write SetUseConnect;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property RemoteHost:String read FRemoteHost write SetRemoteHost;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteAddress:String read FRemoteAddress write SetRemoteAddress;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Connect:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Disconnect:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 TCP client'''
+
'''Stream client classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2TCPClient = class(TWinsock2TCPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Stream Client classes
+
| [[TWinsock2TCPClient|<code>TWinsock2TCPClient = class(TWinsock2TCPSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FRemotePort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFamily(AFamily:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBoundAddress(const ABoundAddress:String); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetRemotePort(ARemotePort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteHost(const ARemoteHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteAddress(const ARemoteAddress:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AllocateFamily:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateRemoteAddress(var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property RemotePort:Word read FRemotePort write SetRemotePort;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteHost:String read FRemoteHost write SetRemoteHost;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteAddress:String read FRemoteAddress write SetRemoteAddress;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Connect:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ConnectEx:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Disconnect:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 UDP client'''
+
'''Datagram client classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2UDPClient = class(TWinsock2UDPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Datagram Client classes
+
| [[TWinsock2UDPClient|<code>TWinsock2UDPClient = class(TWinsock2UDPSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FUseConnect:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FRemotePort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetUseConnect(AUseConnect:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetFamily(AFamily:Integer); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBoundAddress(const ABoundAddress:String); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetRemotePort(ARemotePort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteHost(const ARemoteHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteAddress(const ARemoteAddress:String);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AllocateFamily:Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AllocateRemoteAddress(var ALength:Integer):PSockAddr;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property UseConnect:Boolean read FUseConnect write SetUseConnect;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property RemotePort:Word read FRemotePort write SetRemotePort;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteHost:String read FRemoteHost write SetRemoteHost;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteAddress:String read FRemoteAddress write SetRemoteAddress;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Connect:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Disconnect:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 TCP server'''
+
'''Stream server classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2TCPServer = class(TWinsock2TCPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Stream Server classes
+
| [[TWinsock2TCPServer|<code>TWinsock2TCPServer = class(TWinsock2TCPSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create(AListener:TWinsock2TCPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FPeerPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FPeerAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FListener:TWinsock2TCPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure SetHandle(AHandle:TSocket); virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetLastError(ALastError:LongInt); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property PeerPort:Word read FPeerPort;</code>
+
| &nbsp;
+
|-
+
| <code>property PeerAddress:String read FPeerAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property Listener:TWinsock2TCPListener read FListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Disconnect:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 TCP server thread'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2TCPServerThread = class(TWinsock2SocketThread)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2TCPServerThread|<code>TWinsock2TCPServerThread = class(TWinsock2SocketThread)</code>]]
|-
+
| <code>constructor Create(AServer:TWinsock2TCPServer);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FData:TObject;</code>
+
| &nbsp;
+
|-
+
| <code>FServer:TWinsock2TCPServer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure AfterExecution; override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure BeforeExecution; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Data:TObject read FData write FData;</code>
+
| &nbsp;
+
|-
+
| <code>property Server:TWinsock2TCPServer read FServer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Execution; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 TCP listener thread'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2TCPListenerThread = class(TWinsock2SocketThread)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2TCPListenerThread|<code>TWinsock2TCPListenerThread = class(TWinsock2SocketThread)</code>]]
|-
+
| <code>constructor Create(AListener:TWinsock2TCPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FListener:TWinsock2TCPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure AfterExecution; override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure BeforeExecution; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Listener:TWinsock2TCPListener read FListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Execution; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 TCP server threads'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2TCPServerThreads = class(TWinsock2SocketThreads)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TWinsock2TCPServerThreads|<code>TWinsock2TCPServerThreads = class(TWinsock2SocketThreads)</code>]]
|-
+
| <code>procedure TerminateThread(AThread:TWinsock2TCPServerThread);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>procedure TerminateAll;</code>
+
| &nbsp;
+
|-
+
| <code>function Terminate(AThread:TWinsock2TCPServerThread):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 TCP listener'''
+
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2TCPListener = class(TWinsock2TCPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2TCPListener|<code>TWinsock2TCPListener = class(TWinsock2TCPSocket)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FThreads:TWinsock2TCPServerThreads;</code>
+
| &nbsp;
+
|-
+
| <code>FListenerThread:TWinsock2TCPListenerThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnExecute:TTCPExecuteEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnConnect:TTCPConnectEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnDisconnect:TTCPDisconnectEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnCreateThread:TTCPCreateThreadEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetActive(AActive:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure SetLastError(ALastError:LongInt); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure DoConnect(AThread:TWinsock2TCPServerThread); virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure DoDisconnect(AThread:TWinsock2TCPServerThread); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoExecute(AThread:TWinsock2TCPServerThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Active:Boolean read FActive write SetActive;</code>
+
| &nbsp;
+
|-
+
| <code>property Threads:TWinsock2TCPServerThreads read FThreads;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnExecute:TTCPExecuteEvent read FOnExecute write FOnExecute;</code>
+
| &nbsp;
+
|-
+
| <code>property OnConnect:TTCPConnectEvent read FOnConnect write FOnConnect;</code>
+
| &nbsp;
+
|-
+
| <code>property OnDisconnect:TTCPDisconnectEvent read FOnDisconnect write FOnDisconnect;</code>
+
| &nbsp;
+
|-
+
| <code>property OnCreateThread:TTCPCreateThreadEvent read FOnCreateThread write FOnCreateThread;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Winsock2 UDP server'''
+
'''Datagram server classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TWinsock2UDPServer = class(TWinsock2UDPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: Datagrams Server classes
+
| [[TWinsock2UDPServer|<code>TWinsock2UDPServer = class(TWinsock2UDPSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>constructor Create(AListener:TWinsock2UDPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FPeerPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FPeerAddress:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FUseListener:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FListener:TWinsock2UDPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetUseListener(AUseListener:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FBuffer:TWinsock2UDPServerBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetData:Pointer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function GetSize:Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function GetCount:Integer; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetBuffer(ABuffer:TWinsock2UDPServerBuffer); virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetLastError(ALastError:LongInt); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property PeerPort:Word read FPeerPort;</code>
+
| &nbsp;
+
|-
+
| <code>property PeerAddress:String read FPeerAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property UseListener:Boolean read FUseListener write SetUseListener;</code>
+
| &nbsp;
+
|-
+
| <code>property Listener:TWinsock2UDPListener read FListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Buffer:TWinsock2UDPServerBuffer read FBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Data:Pointer read GetData;</code>
+
| &nbsp;
+
|-
+
| <code>property Size:Integer read GetSize;</code>
+
| &nbsp;
+
|-
+
| <code>property Count:Integer read GetCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendData(AData:Pointer; ACount:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendDataTo(const AHost:String; APort:Word; AData:Pointer; ACount:Integer):Integer; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP server thread'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPServerThread = class(TWinsock2SocketThread)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPServerThread|<code>TWinsock2UDPServerThread = class(TWinsock2SocketThread)</code>]]
|-
+
| <code>constructor Create(AServer:TWinsock2UDPServer);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FData:TObject;</code>
+
| &nbsp;
+
|-
+
| <code>FServer:TWinsock2UDPServer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetActive(AActive:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure AfterExecution; override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure BeforeExecution; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Active:Boolean read GetActive write SetActive;</code>
+
| &nbsp;
+
|-
+
| <code>property Data:TObject read FData write FData;</code>
+
| &nbsp;
+
|-
+
| <code>property Server:TWinsock2UDPServer read FServer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Execution; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP listener thread'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPListenerThread = class(TWinsock2SocketThread)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPListenerThread|<code>TWinsock2UDPListenerThread = class(TWinsock2SocketThread)</code>]]
|-
+
| <code>constructor Create(AListener:TWinsock2UDPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FListener:TWinsock2UDPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure AfterExecution; override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure BeforeExecution; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Listener:TWinsock2UDPListener read FListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Execution; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP server threads'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPServerThreads = class(TWinsock2SocketThreads)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPServerThreads|<code>TWinsock2UDPServerThreads = class(TWinsock2SocketThreads)</code>]]
|-
+
| <code>constructor Create(AListener:TWinsock2UDPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FMin:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FMax:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FListener:TWinsock2UDPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetMin:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMin(AMin:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetMax:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMax(AMax:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure CreateThreads;</code>
+
| &nbsp;
+
|-
+
| <code>function CreateThread(AForce:Boolean):TWinsock2UDPServerThread;</code>
+
| &nbsp;
+
|-
+
| <code>procedure TerminateThread(AThread:TWinsock2UDPServerThread);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Min:Integer read GetMin write SetMin;</code>
+
| &nbsp;
+
|-
+
| <code>property Max:Integer read GetMax write SetMax;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetThread:TWinsock2UDPServerThread;</code>
+
| &nbsp;
+
|-
+
| <code>procedure ReleaseThread(AThread:TWinsock2UDPServerThread);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure TerminateAll;</code>
+
| &nbsp;
+
|-
+
| <code>function Terminate(AThread:TWinsock2UDPServerThread):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP server buffer'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPServerBuffer = class(TWinsock2SocketBuffer)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPServerBuffer|<code>TWinsock2UDPServerBuffer = class(TWinsock2SocketBuffer)</code>]]
|-
+
| <code>constructor Create(ASize:Integer);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FData:Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>FSize:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FCount:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetActive(AActive:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetCount(ACount:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Active:Boolean read GetActive write SetActive;</code>
+
| &nbsp;
+
|-
+
| <code>property Data:Pointer read FData;</code>
+
| &nbsp;
+
|-
+
| <code>property Size:Integer read FSize;</code>
+
| &nbsp;
+
|-
+
| <code>property Count:Integer read FCount write SetCount;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP server buffers'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPServerBuffers = class(TWinsock2SocketBuffers)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPServerBuffers|<code>TWinsock2UDPServerBuffers = class(TWinsock2SocketBuffers)</code>]]
|-
+
| <code>constructor Create(AListener:TWinsock2UDPListener);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FMin:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>FMax:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FListener:TWinsock2UDPListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetMin:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMin(AMin:Integer);</code>
+
| &nbsp;
+
|-
+
| <code>function GetMax:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetMax(AMax:Integer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure CreateBuffers;</code>
+
| &nbsp;
+
|-
+
| <code>function CreateBuffer(AForce:Boolean):TWinsock2UDPServerBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure DeleteBuffer(ABuffer:TWinsock2UDPServerBuffer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Min:Integer read GetMin write SetMin;</code>
+
| &nbsp;
+
|-
+
| <code>property Max:Integer read GetMax write SetMax;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetBuffer:TWinsock2UDPServerBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>procedure ReleaseBuffer(ABuffer:TWinsock2UDPServerBuffer);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure DeleteAll;</code>
+
| &nbsp;
+
|-
+
| <code>function Delete(ABuffer:TWinsock2UDPServerBuffer):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Winsock2 UDP listener'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TWinsock2UDPListener = class(TWinsock2UDPSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TWinsock2UDPListener|<code>TWinsock2UDPListener = class(TWinsock2UDPSocket)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FActive:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FUseListener:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>FThreads:TWinsock2UDPServerThreads;</code>
+
| &nbsp;
+
|-
+
| <code>FBuffers:TWinsock2UDPServerBuffers;</code>
+
| &nbsp;
+
|-
+
| <code>FListenerThread:TWinsock2UDPListenerThread;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnExecute:TUDPExecuteEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnCreateThread:TUDPCreateThreadEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnCreateBuffer:TUDPCreateBufferEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetActive(AActive:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetUseListener(AUseListener:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure SetLastError(ALastError:LongInt); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoExecute(AThread:TWinsock2UDPServerThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendToSocketEx(AHandle:THandle; ASockAddr:PSockAddr; ASockLen:Integer; AData:Pointer; ASize:Integer; var ACount:Integer):LongInt; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Active:Boolean read FActive write SetActive;</code>
+
| &nbsp;
+
|-
+
| <code>property UseListener:Boolean read FUseListener write SetUseListener;</code>
+
| &nbsp;
+
|-
+
| <code>property Threads:TWinsock2UDPServerThreads read FThreads;</code>
+
| &nbsp;
+
|-
+
| <code>property Buffers:TWinsock2UDPServerBuffers read FBuffers;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnExecute:TUDPExecuteEvent read FOnExecute write FOnExecute;</code>
+
| &nbsp;
+
|-
+
| <code>property OnCreateThread:TUDPCreateThreadEvent read FOnCreateThread write FOnCreateThread;</code>
+
| &nbsp;
+
|-
+
| <code>property OnCreateBuffer:TUDPCreateBufferEvent read FOnCreateBuffer write FOnCreateBuffer;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
<br />
 
<br />
  
Line 3,979: Line 2,216:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 3,991: Line 2,228:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,003: Line 2,240:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,015: Line 2,252:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,030: Line 2,267:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,042: Line 2,279:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,054: Line 2,291:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,066: Line 2,303:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,078: Line 2,315:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,090: Line 2,327:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,102: Line 2,339:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,114: Line 2,351:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,126: Line 2,363:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,138: Line 2,375:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,150: Line 2,387:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,162: Line 2,399:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,174: Line 2,411:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,186: Line 2,423:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,198: Line 2,435:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,210: Line 2,447:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,222: Line 2,459:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,234: Line 2,471:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| As per the Winsock specification, the buffer returned by this function is only guaranteed to be valid until the next Winsock function call is made within the same thread. Therefore, the data should be copied before another Winsock call.
 
| As per the Winsock specification, the buffer returned by this function is only guaranteed to be valid until the next Winsock function call is made within the same thread. Therefore, the data should be copied before another Winsock call.
 
|-
 
|-
Line 4,246: Line 2,483:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,258: Line 2,495:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,270: Line 2,507:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,282: Line 2,519:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,294: Line 2,531:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,306: Line 2,543:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,318: Line 2,555:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,330: Line 2,567:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,342: Line 2,579:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,354: Line 2,591:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| All sockets contained by the FDSet must be of the same type
 
| All sockets contained by the FDSet must be of the same type
 
|-
 
|-
Line 4,366: Line 2,603:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,378: Line 2,615:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,390: Line 2,627:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,402: Line 2,639:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,414: Line 2,651:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,426: Line 2,663:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,438: Line 2,675:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,450: Line 2,687:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,462: Line 2,699:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,474: Line 2,711:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,486: Line 2,723:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,498: Line 2,735:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,510: Line 2,747:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,522: Line 2,759:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,534: Line 2,771:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,546: Line 2,783:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,558: Line 2,795:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,570: Line 2,807:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,582: Line 2,819:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,594: Line 2,831:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,606: Line 2,843:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,618: Line 2,855:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,630: Line 2,867:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,642: Line 2,879:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,654: Line 2,891:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,666: Line 2,903:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,678: Line 2,915:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,690: Line 2,927:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,702: Line 2,939:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,714: Line 2,951:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,726: Line 2,963:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,738: Line 2,975:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,750: Line 2,987:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,762: Line 2,999:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,774: Line 3,011:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,786: Line 3,023:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,798: Line 3,035:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,810: Line 3,047:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,822: Line 3,059:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,834: Line 3,071:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,846: Line 3,083:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,858: Line 3,095:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,870: Line 3,107:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,882: Line 3,119:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,894: Line 3,131:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,906: Line 3,143:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,921: Line 3,158:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,933: Line 3,170:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,945: Line 3,182:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,960: Line 3,197:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 4,975: Line 3,212:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Not intended to be called directly by applications
 
| Not intended to be called directly by applications
 
|-
 
|-
Line 4,987: Line 3,224:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Not intended to be called directly by applications
 
| Not intended to be called directly by applications
 
|-
 
|-
Line 4,999: Line 3,236:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| Not intended to be called directly by applications
 
| Not intended to be called directly by applications
 
|-
 
|-
Line 5,014: Line 3,251:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''s'''
+
! s
 
| The socket to redirect input to (or INVALID_SOCKET to stop redirection)
 
| The socket to redirect input to (or INVALID_SOCKET to stop redirection)
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if completed successfully or False if an error occurred
 
| True if completed successfully or False if an error occurred
 
|-
 
|-
! '''Note'''
+
! Note
 
| Redirects the input of the text file Input which also redirects the input of Read, ReadLn and the standard C library.
 
| Redirects the input of the text file Input which also redirects the input of Read, ReadLn and the standard C library.
 
|-
 
|-
Line 5,032: Line 3,269:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''s'''
+
! s
 
| The socket to redirect output to (or INVALID_SOCKET to stop redirection)
 
| The socket to redirect output to (or INVALID_SOCKET to stop redirection)
 
|-
 
|-
! '''Return'''
+
! Return
 
| True if completed successfully or False if an error occurred
 
| True if completed successfully or False if an error occurred
 
|-
 
|-
! '''Note'''
+
! Note
 
| Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library.
 
| Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library.
 
|-
 
|-
Line 5,050: Line 3,287:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 05:34, 31 August 2021

Return to Unit Reference


Description


Ultibo Winsock2 Interface unit

Notes:

  • All BSD/Winsock functions that accept an Address or Port expect them to be in Network order.
  • All other functions that take an Address or Port expect them to be in Host order.

Constants



Winsock2 specific constants WINSOCK_*
WINSOCK_VERSION = $0202;  
 
WINSOCK_TCP_SERVER_THREAD_NAME = 'TCP Server'; Thread name for TCP server threads
WINSOCK_TCP_SERVER_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL; Thread priority for TCP server threads
 
WINSOCK_TCP_LISTENER_THREAD_NAME = 'TCP Listener'; Thread name for TCP listener threads
WINSOCK_TCP_LISTENER_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL; Thread priority for TCP listener threads
 
WINSOCK_UDP_SERVER_THREAD_NAME = 'UDP Server'; Thread name for UDP server threads
WINSOCK_UDP_SERVER_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL; Thread priority for UDP server threads
 
WINSOCK_UDP_LISTENER_THREAD_NAME = 'UDP Listener'; Thread name for UDP listener threads
WINSOCK_UDP_LISTENER_THREAD_PRIORITY = THREAD_PRIORITY_NORMAL; Thread priority for UDP listener threads
 
FD_SETSIZE = GlobalSock.FD_SETSIZE;  
 
IOCPARM_MASK = GlobalSock.IOCPARM_MASK;  
IOC_VOID = GlobalSock.IOC_VOID;  
IOC_OUT = GlobalSock.IOC_OUT;  
IOC_IN = GlobalSock.IOC_IN;  
IOC_INOUT = GlobalSock.IOC_INOUT;  
 
FIONREAD = GlobalSock.FIONREAD;  
FIONBIO = GlobalSock.FIONBIO;  
FIOASYNC = GlobalSock.FIOASYNC;  
 
SIOCSHIWAT = GlobalSock.SIOCSHIWAT;  
SIOCGHIWAT = GlobalSock.SIOCGHIWAT;  
SIOCSLOWAT = GlobalSock.SIOCSLOWAT;  
SIOCGLOWAT = GlobalSock.SIOCGLOWAT;  
SIOCATMARK = GlobalSock.SIOCATMARK;  
 
IMPLINK_IP = GlobalSock.IMPLINK_IP;  
IMPLINK_LOWEXPER = GlobalSock.IMPLINK_LOWEXPER;  
IMPLINK_HIGHEXPER = GlobalSock.IMPLINK_HIGHEXPER;  
 
TF_DISCONNECT = GlobalSock.TF_DISCONNECT;  
TF_REUSE_SOCKET = GlobalSock.TF_REUSE_SOCKET;  
TF_WRITE_BEHIND = GlobalSock.TF_WRITE_BEHIND;  
 
INET_ADDRSTR_ANY = GlobalSock.INET_ADDRSTR_ANY;  
INET6_ADDRSTR_INIT = GlobalSock.INET6_ADDRSTR_INIT;  
 
INET_ADDRSTR_BROADCAST = GlobalSock.INET_ADDRSTR_BROADCAST;  
 
INET_ADDRSTRLEN = GlobalSock.INET_ADDRSTRLEN;  
INET6_ADDRSTRLEN = GlobalSock.INET6_ADDRSTRLEN;  
 
IN6ADDR_ANY_INIT:TIn6Addr = (u6_addr16: (0, 0, 0, 0, 0, 0, 0, 0));  
IN6ADDR_LOOPBACK_INIT:TIn6Addr = (u6_addr8: (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1));  
 
INADDR_ANY = GlobalSock.INADDR_ANY;  
INADDR_LOOPBACK = GlobalSock.INADDR_LOOPBACK;  
INADDR_BROADCAST = GlobalSock.INADDR_BROADCAST;  
INADDR_NONE = GlobalSock.INADDR_NONE;  
 
IN6ADDR_ANY:TIn6Addr = (u6_addr16: (0, 0, 0, 0, 0, 0, 0, 0));  
IN6ADDR_LOOPBACK:TIn6Addr = (u6_addr8: (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1));  
 
Level number for (get/set)sockopt() to apply to socket itself
SOL_SOCKET = GlobalSock.SOL_SOCKET;  
 
Maximum queue length specifiable by listen
SOMAXCONN = GlobalSock.SOMAXCONN;  
 
Return flags
RESULT_IS_ALIAS = $0001;  
 
SERVICE_MULTIPLE = $00000001;  
 
BIGENDIAN = $0000;  
LITTLEENDIAN = $0001;  
 
SECURITY_PROTOCOL_NONE = $0000;  
 
This is used instead of -1, since the TSocket type is unsigned
INVALID_SOCKET = GlobalSock.INVALID_SOCKET;  
SOCKET_ERROR = GlobalSock.SOCKET_ERROR;  
 
Define constant based on rfc883, used by gethostbyxxxx() calls
MAXGETHOSTSTRUCT = GlobalSock.MAXGETHOSTSTRUCT;  
 
WSADESCRIPTION_LEN = GlobalSock.WSADESCRIPTION_LEN;  
WSASYS_STATUS_LEN = GlobalSock.WSASYS_STATUS_LEN;  
MAX_PROTOCOL_CHAIN = 7;  
BASE_PROTOCOL = 1;  
LAYERED_PROTOCOL = 0;  
WSAPROTOCOL_LEN = 255;  


IP protocol IPPROTO_*
IPPROTO_IP = GlobalSock.IPPROTO_IP;  
IPPROTO_ICMP = GlobalSock.IPPROTO_ICMP;  
IPPROTO_IGMP = GlobalSock.IPPROTO_IGMP;  
IPPROTO_GGP = GlobalSock.IPPROTO_GGP;  
IPPROTO_TCP = GlobalSock.IPPROTO_TCP;  
IPPROTO_EGP = GlobalSock.IPPROTO_EGP;  
IPPROTO_PUP = GlobalSock.IPPROTO_PUP;  
IPPROTO_UDP = GlobalSock.IPPROTO_UDP;  
IPPROTO_HMP = GlobalSock.IPPROTO_HMP;  
IPPROTO_IDP = GlobalSock.IPPROTO_IDP;  
IPPROTO_RDP = GlobalSock.IPPROTO_RDP;  
IPPROTO_IPV6 = GlobalSock.IPPROTO_IPV6;  
IPPROTO_ROUTING = GlobalSock.IPPROTO_ROUTING;  
IPPROTO_FRAGMENT = GlobalSock.IPPROTO_FRAGMENT;  
IPPROTO_ICMPV6 = GlobalSock.IPPROTO_ICMPV6;  
IPPROTO_RVD = GlobalSock.IPPROTO_RVD;  
IPPROTO_ND = GlobalSock.IPPROTO_ND;  
IPPROTO_RAW = GlobalSock.IPPROTO_RAW;  
IPPROTO_MAX = GlobalSock.IPPROTO_MAX;  


IP port IPPORT_*
Port/socket numbers: network standard functions
IPPORT_ANY = GlobalSock.IPPORT_ANY;  
IPPORT_ECHO = GlobalSock.IPPORT_ECHO;  
IPPORT_DISCARD = GlobalSock.IPPORT_DISCARD;  
IPPORT_SYSTAT = GlobalSock.IPPORT_SYSTAT;  
IPPORT_DAYTIME = GlobalSock.IPPORT_DAYTIME;  
IPPORT_NETSTAT = GlobalSock.IPPORT_NETSTAT;  
IPPORT_FTP = GlobalSock.IPPORT_FTP;  
IPPORT_TELNET = GlobalSock.IPPORT_TELNET;  
IPPORT_SMTP = GlobalSock.IPPORT_SMTP;  
IPPORT_TIMESERVER = GlobalSock.IPPORT_TIMESERVER;  
IPPORT_NAMESERVER = GlobalSock.IPPORT_NAMESERVER;  
IPPORT_WHOIS = GlobalSock.IPPORT_WHOIS;  
IPPORT_DNS = GlobalSock.IPPORT_DNS;  
IPPORT_MTP = GlobalSock.IPPORT_MTP;  
IPPORT_BOOTPS = GlobalSock.IPPORT_BOOTPS;  
IPPORT_BOOTPC = GlobalSock.IPPORT_BOOTPC;  
 
Port/socket numbers: host specific functions
IPPORT_TFTP = GlobalSock.IPPORT_TFTP;  
IPPORT_RJE = GlobalSock.IPPORT_RJE;  
IPPORT_FINGER = GlobalSock.IPPORT_FINGER;  
IPPORT_TTYLINK = GlobalSock.IPPORT_TTYLINK;  
IPPORT_SUPDUP = GlobalSock.IPPORT_SUPDUP;  
 
UNIX TCP sockets
IPPORT_EXECSERVER = GlobalSock.IPPORT_EXECSERVER;  
IPPORT_LOGINSERVER = GlobalSock.IPPORT_LOGINSERVER;  
IPPORT_CMDSERVER = GlobalSock.IPPORT_CMDSERVER;  
IPPORT_EFSSERVER = GlobalSock.IPPORT_EFSSERVER;  
 
UNIX UDP sockets
IPPORT_BIFFUDP = GlobalSock.IPPORT_BIFFUDP;  
IPPORT_WHOSERVER = GlobalSock.IPPORT_WHOSERVER;  
IPPORT_ROUTESERVER = GlobalSock.IPPORT_ROUTESERVER;  
 
Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root)
IPPORT_RESERVED = GlobalSock.IPPORT_RESERVED;  


IP option IP_*
Options for use with [gs]etsockopt at the IP level
 
IP_OPTIONS = GlobalSock.IP_OPTIONS;  
IP_MULTICAST_IF = GlobalSock.IP_MULTICAST_IF;  
IP_MULTICAST_TTL = GlobalSock.IP_MULTICAST_TTL;  
IP_MULTICAST_LOOP = GlobalSock.IP_MULTICAST_LOOP;  
IP_ADD_MEMBERSHIP = GlobalSock.IP_ADD_MEMBERSHIP;  
IP_DROP_MEMBERSHIP = GlobalSock.IP_DROP_MEMBERSHIP;  
IP_TTL = GlobalSock.IP_TTL;  
IP_TOS = GlobalSock.IP_TOS;  
IP_DONTFRAGMENT = GlobalSock.IP_DONTFRAGMENT;  
IP_HDRINCL = GlobalSock.IP_HDRINCL;  
 
IP_DEFAULT_MULTICAST_TTL = GlobalSock.IP_DEFAULT_MULTICAST_TTL;  
IP_DEFAULT_MULTICAST_LOOP = GlobalSock.IP_DEFAULT_MULTICAST_LOOP;  
IP_MAX_MEMBERSHIPS = GlobalSock.IP_MAX_MEMBERSHIPS;  


Socket type SOCK_*
SOCK_UNSPEC = GlobalSock.SOCK_UNSPEC;  
SOCK_STREAM = GlobalSock.SOCK_STREAM;  
SOCK_DGRAM = GlobalSock.SOCK_DGRAM;  
SOCK_RAW = GlobalSock.SOCK_RAW;  
SOCK_RDM = GlobalSock.SOCK_RDM;  
SOCK_SEQPACKET = GlobalSock.SOCK_SEQPACKET;  
SOCK_PACKET = GlobalSock.SOCK_PACKET;  


Socket option SO_*
SO_DEBUG = GlobalSock.SO_DEBUG;  
SO_ACCEPTCONN = GlobalSock.SO_ACCEPTCONN;  
SO_REUSEADDR = GlobalSock.SO_REUSEADDR;  
SO_KEEPALIVE = GlobalSock.SO_KEEPALIVE;  
SO_DONTROUTE = GlobalSock.SO_DONTROUTE;  
SO_BROADCAST = GlobalSock.SO_BROADCAST;  
SO_USELOOPBACK = GlobalSock.SO_USELOOPBACK;  
SO_LINGER = GlobalSock.SO_LINGER;  
SO_OOBINLINE = GlobalSock.SO_OOBINLINE;  
 
SO_DONTLINGER = GlobalSock.SO_DONTLINGER;  
 
Additional options
SO_SNDBUF = GlobalSock.SO_SNDBUF;  
SO_RCVBUF = GlobalSock.SO_RCVBUF;  
SO_SNDLOWAT = GlobalSock.SO_SNDLOWAT;  
SO_RCVLOWAT = GlobalSock.SO_RCVLOWAT;  
SO_SNDTIMEO = GlobalSock.SO_SNDTIMEO;  
SO_RCVTIMEO = GlobalSock.SO_RCVTIMEO;  
SO_ERROR = GlobalSock.SO_ERROR;  
SO_TYPE = GlobalSock.SO_TYPE;  
SO_CONNTIMEO = GlobalSock.SO_CONNTIMEO;  
 
Options for connect and disconnect data and options. Used only by non-TCP/IP transports such as DECNet, OSI TP4, etc
SO_CONNDATA = GlobalSock.SO_CONNDATA;  
SO_CONNOPT = GlobalSock.SO_CONNOPT;  
SO_DISCDATA = GlobalSock.SO_DISCDATA;  
SO_DISCOPT = GlobalSock.SO_DISCOPT;  
SO_CONNDATALEN = GlobalSock.SO_CONNDATALEN;  
SO_CONNOPTLEN = GlobalSock.SO_CONNOPTLEN;  
SO_DISCDATALEN = GlobalSock.SO_DISCDATALEN;  
SO_DISCOPTLEN = GlobalSock.SO_DISCOPTLEN;  
 
Option for opening sockets for synchronous access
SO_OPENTYPE = GlobalSock.SO_OPENTYPE;  
SO_SYNCHRONOUS_ALERT = GlobalSock.SO_SYNCHRONOUS_ALERT;  
SO_SYNCHRONOUS_NONALERT = GlobalSock.SO_SYNCHRONOUS_NONALERT;  
 
Other NT-specific options
SO_MAXDG = GlobalSock.SO_MAXDG;  
SO_MAXPATHDG = GlobalSock.SO_MAXPATHDG;  
SO_UPDATE_ACCEPT_CONTEXT = GlobalSock.SO_UPDATE_ACCEPT_CONTEXT;  
SO_CONNECT_TIME = GlobalSock.SO_CONNECT_TIME;  


TCP option TCP_*
TCP_NODELAY= GlobalSock.TCP_NODELAY;  
TCP_MAXSEG = GlobalSock.TCP_MAXSEG;  
TCP_NOPUSH = GlobalSock.TCP_NOPUSH;  
TCP_NOOPT = GlobalSock.TCP_NOOPT;  
TCP_BSDURGENT = GlobalSock.TCP_BSDURGENT;  
 
TCP_WSCALE = GlobalSock.TCP_WSCALE;  
TCP_NOSACK = GlobalSock.TCP_NOSACK;  


UDP option UDP_*
UDP_NOCHECKSUM = GlobalSock.UDP_NOCHECKSUM;  


Address family AF_*
AF_UNSPEC = GlobalSock.AF_UNSPEC;  
AF_UNIX = GlobalSock.AF_UNIX;  
AF_INET = GlobalSock.AF_INET;  
AF_IMPLINK = GlobalSock.AF_IMPLINK;  
AF_PUP = GlobalSock.AF_PUP;  
AF_CHAOS = GlobalSock.AF_CHAOS;  
AF_IPX = GlobalSock.AF_IPX;  
AF_NS = GlobalSock.AF_NS;  
AF_ISO = GlobalSock.AF_ISO;  
AF_OSI = GlobalSock.AF_OSI;  
AF_ECMA = GlobalSock.AF_ECMA;  
AF_DATAKIT = GlobalSock.AF_DATAKIT;  
AF_CCITT = GlobalSock.AF_CCITT;  
AF_SNA = GlobalSock.AF_SNA;  
AF_DECnet = GlobalSock.AF_DECnet;  
AF_DLI = GlobalSock.AF_DLI;  
AF_LAT = GlobalSock.AF_LAT;  
AF_HYLINK = GlobalSock.AF_HYLINK;  
AF_APPLETALK = GlobalSock.AF_APPLETALK;  
AF_NETBIOS = GlobalSock.AF_NETBIOS;  
AF_VOICEVIEW = GlobalSock.AF_VOICEVIEW;  
AF_FIREFOX = GlobalSock.AF_FIREFOX;  
AF_UNKNOWN1 = GlobalSock.AF_UNKNOWN1;  
AF_BAN = GlobalSock.AF_BAN;  
AF_ATM = GlobalSock.AF_ATM;  
AF_INET6 = GlobalSock.AF_INET6;  
AF_CLUSTER = GlobalSock.AF_CLUSTER;  
AF_12844 = GlobalSock.AF_12844;  
AF_IRDA = GlobalSock.AF_IRDA;  
AF_NETDES = GlobalSock.AF_NETDES;  
 
AF_MAX = GlobalSock.AF_MAX;  


Protocol family PF_*
PF_UNSPEC = GlobalSock.PF_UNSPEC;  
PF_UNIX = GlobalSock.PF_UNIX;  
PF_INET = GlobalSock.PF_INET;  
PF_IMPLINK = GlobalSock.PF_IMPLINK;  
PF_PUP = GlobalSock.PF_PUP;  
PF_CHAOS = GlobalSock.PF_CHAOS;  
PF_NS = GlobalSock.PF_NS;  
PF_IPX = GlobalSock.PF_IPX;  
PF_ISO = GlobalSock.PF_ISO;  
PF_OSI = GlobalSock.PF_OSI;  
PF_ECMA = GlobalSock.PF_ECMA;  
PF_DATAKIT = GlobalSock.PF_DATAKIT;  
PF_CCITT = GlobalSock.PF_CCITT;  
PF_SNA = GlobalSock.PF_SNA;  
PF_DECnet = GlobalSock.PF_DECnet;  
PF_DLI = GlobalSock.PF_DLI;  
PF_LAT = GlobalSock.PF_LAT;  
PF_HYLINK = GlobalSock.PF_HYLINK;  
PF_APPLETALK = GlobalSock.PF_APPLETALK;  
PF_VOICEVIEW = GlobalSock.PF_VOICEVIEW;  
PF_FIREFOX = GlobalSock.PF_FIREFOX;  
PF_UNKNOWN1 = GlobalSock.PF_UNKNOWN1;  
PF_BAN = GlobalSock.PF_BAN;  
PF_ATM = GlobalSock.PF_ATM;  
PF_INET6 = GlobalSock.PF_INET6;  
PF_CLUSTER = GlobalSock.PF_CLUSTER;  
PF_12844 = GlobalSock.PF_12844;  
PF_IRDA = GlobalSock.PF_IRDA;  
PF_NETDES = GlobalSock.PF_NETDES;  
 
PF_MAX = GlobalSock.PF_MAX;  


Message flag MSG_*
MSG_OOB = GlobalSock.MSG_OOB;  
MSG_PEEK = GlobalSock.MSG_PEEK;  
MSG_DONTROUTE = GlobalSock.MSG_DONTROUTE;  
 
MSG_INTERRUPT = GlobalSock.MSG_INTERRUPT;  
MSG_MAXIOVLEN = GlobalSock.MSG_MAXIOVLEN;  
 
MSG_PARTIAL = GlobalSock.MSG_PARTIAL;  


FD option FD_*
WinSock 2 extension -- bit values and indices for FD_XXX network events
 
FD_READ_BIT = 0;  
FD_READ = (1 shl FD_READ_BIT);  
FD_WRITE_BIT = 1;  
FD_WRITE = (1 shl FD_WRITE_BIT);  
FD_OOB_BIT = 2;  
FD_OOB = (1 shl FD_OOB_BIT);  
FD_ACCEPT_BIT = 3;  
FD_ACCEPT = (1 shl FD_ACCEPT_BIT);  
FD_CONNECT_BIT = 4;  
FD_CONNECT = (1 shl FD_CONNECT_BIT);  
FD_CLOSE_BIT = 5;  
FD_CLOSE = (1 shl FD_CLOSE_BIT);  
FD_QOS_BIT = 6;  
FD_QOS = (1 shl FD_QOS_BIT);  
FD_GROUP_QOS_BIT = 7;  
FD_GROUP_QOS = (1 shl FD_GROUP_QOS_BIT);  
FD_MAX_EVENTS = 8;  
FD_ALL_EVENTS = ((1 shl FD_MAX_EVENTS) - 1);  


Socket error WSAE*
All Windows Sockets error constants are biased by WSABASEERR from the "normal"
 
WSABASEERR = GlobalSock.WSABASEERR;  
 
Windows Sockets definitions of regular Microsoft C error constants
WSAEINTR = GlobalSock.WSAEINTR;  
WSAEBADF = GlobalSock.WSAEBADF;  
WSAEACCES = GlobalSock.WSAEACCES;  
WSAEFAULT = GlobalSock.WSAEFAULT;  
WSAEINVAL = GlobalSock.WSAEINVAL;  
WSAEMFILE = GlobalSock.WSAEMFILE;  
 
Windows Sockets definitions of regular Berkeley error constants
WSAEWOULDBLOCK = GlobalSock.WSAEWOULDBLOCK;  
WSAEINPROGRESS = GlobalSock.WSAEINPROGRESS;  
WSAEALREADY = GlobalSock.WSAEALREADY;  
WSAENOTSOCK = GlobalSock.WSAENOTSOCK;  
WSAEDESTADDRREQ = GlobalSock.WSAEDESTADDRREQ;  
WSAEMSGSIZE = GlobalSock.WSAEMSGSIZE;  
WSAEPROTOTYPE = GlobalSock.WSAEPROTOTYPE;  
WSAENOPROTOOPT = GlobalSock.WSAENOPROTOOPT;  
WSAEPROTONOSUPPORT = GlobalSock.WSAEPROTONOSUPPORT;  
WSAESOCKTNOSUPPORT = GlobalSock.WSAESOCKTNOSUPPORT;  
WSAEOPNOTSUPP = GlobalSock.WSAEOPNOTSUPP;  
WSAEPFNOSUPPORT = GlobalSock.WSAEPFNOSUPPORT;  
WSAEAFNOSUPPORT = GlobalSock.WSAEAFNOSUPPORT;  
WSAEADDRINUSE = GlobalSock.WSAEADDRINUSE;  
WSAEADDRNOTAVAIL = GlobalSock.WSAEADDRNOTAVAIL;  
WSAENETDOWN = GlobalSock.WSAENETDOWN;  
WSAENETUNREACH = GlobalSock.WSAENETUNREACH;  
WSAENETRESET = GlobalSock.WSAENETRESET;  
WSAECONNABORTED = GlobalSock.WSAECONNABORTED;  
WSAECONNRESET = GlobalSock.WSAECONNRESET;  
WSAENOBUFS = GlobalSock.WSAENOBUFS;  
WSAEISCONN = GlobalSock.WSAEISCONN;  
WSAENOTCONN = GlobalSock.WSAENOTCONN;  
WSAESHUTDOWN = GlobalSock.WSAESHUTDOWN;  
WSAETOOMANYREFS = GlobalSock.WSAETOOMANYREFS;  
WSAETIMEDOUT = GlobalSock.WSAETIMEDOUT;  
WSAECONNREFUSED = GlobalSock.WSAECONNREFUSED;  
WSAELOOP = GlobalSock.WSAELOOP;  
WSAENAMETOOLONG = GlobalSock.WSAENAMETOOLONG;  
WSAEHOSTDOWN = GlobalSock.WSAEHOSTDOWN;  
WSAEHOSTUNREACH = GlobalSock.WSAEHOSTUNREACH;  
WSAENOTEMPTY = GlobalSock.WSAENOTEMPTY;  
WSAEPROCLIM = GlobalSock.WSAEPROCLIM;  
WSAEUSERS = GlobalSock.WSAEUSERS;  
WSAEDQUOT = GlobalSock.WSAEDQUOT;  
WSAESTALE = GlobalSock.WSAESTALE;  
WSAEREMOTE = GlobalSock.WSAEREMOTE;  
 
WSAEDISCON = GlobalSock.WSAEDISCON;  
 
Extended Windows Sockets error constant definitions
WSASYSNOTREADY = GlobalSock.WSASYSNOTREADY;  
WSAVERNOTSUPPORTED = GlobalSock.WSAVERNOTSUPPORTED;  
WSANOTINITIALISED = GlobalSock.WSANOTINITIALISED;  
 
WSAENOMORE = GlobalSock.WSAENOMORE;  
WSAECANCELLED = GlobalSock.WSAECANCELLED;  
WSAEINVALIDPROCTABLE = GlobalSock.WSAEINVALIDPROCTABLE;  
WSAEINVALIDPROVIDER = GlobalSock.WSAEINVALIDPROVIDER;  
WSAEPROVIDERFAILEDINIT = GlobalSock.WSAEPROVIDERFAILEDINIT;  
WSASYSCALLFAILURE = GlobalSock.WSASYSCALLFAILURE;  
WSASERVICE_NOT_FOUND = GlobalSock.WSASERVICE_NOT_FOUND;  
WSATYPE_NOT_FOUND = GlobalSock.WSATYPE_NOT_FOUND;  
WSA_E_NO_MORE = GlobalSock.WSA_E_NO_MORE;  
WSA_E_CANCELLED = GlobalSock.WSA_E_CANCELLED;  
WSAEREFUSED = GlobalSock.WSAEREFUSED;  
 
Error return codes from gethostbyname() and gethostbyaddr() (when using the resolver). Note that these errors are retrieved via WSAGetLastError() and must therefore follow the rules for avoiding clashes with error numbers from specific implementations or language run-time systems. For this reason the codes are based at WSABASEERR+1001. Note also that [WSA]NO_ADDRESS is defined only for compatibility purposes.
 
Authoritative Answer: Host not found
WSAHOST_NOT_FOUND = GlobalSock.WSAHOST_NOT_FOUND;  
HOST_NOT_FOUND = GlobalSock.HOST_NOT_FOUND;  
 
Non-Authoritative: Host not found, or SERVERFAIL
WSATRY_AGAIN = GlobalSock.WSATRY_AGAIN;  
TRY_AGAIN = GlobalSock.TRY_AGAIN;  
 
Non recoverable errors, FORMERR, REFUSED, NOTIMP
WSANO_RECOVERY = GlobalSock.WSANO_RECOVERY;  
NO_RECOVERY = GlobalSock.NO_RECOVERY;  
 
Valid name, no data record of requested type
WSANO_DATA = GlobalSock.WSANO_DATA;  
NO_DATA = GlobalSock.NO_DATA;  
 
no address, look for MX record
WSANO_ADDRESS = GlobalSock.WSANO_ADDRESS;  
NO_ADDRESS = GlobalSock.NO_ADDRESS;  
 
WinSock 2 extension -- new error codes and type definition
WSA_IO_PENDING = GlobalSock.WSA_IO_PENDING;  
WSA_IO_INCOMPLETE = GlobalSock.WSA_IO_INCOMPLETE;  
WSA_INVALID_HANDLE = GlobalSock.WSA_INVALID_HANDLE;  
WSA_INVALID_PARAMETER = GlobalSock.WSA_INVALID_PARAMETER;  
WSA_NOT_ENOUGH_MEMORY = GlobalSock.WSA_NOT_ENOUGH_MEMORY;  
WSA_OPERATION_ABORTED = GlobalSock.WSA_OPERATION_ABORTED;  
WSA_INVALID_EVENT = GlobalSock.WSA_INVALID_EVENT;  
WSA_MAXIMUM_WAIT_EVENTS = GlobalSock.WSA_MAXIMUM_WAIT_EVENTS;  
WSA_WAIT_FAILED = GlobalSock.WSA_WAIT_FAILED;  
WSA_WAIT_EVENT_0 = GlobalSock.WSA_WAIT_EVENT_0;  
WSA_WAIT_IO_COMPLETION = GlobalSock.WSA_WAIT_IO_COMPLETION;  
WSA_WAIT_TIMEOUT = GlobalSock.WSA_WAIT_TIMEOUT;  
WSA_INFINITE = GlobalSock.WSA_INFINITE;  
 
Windows Sockets errors redefined as regular Berkeley error constants. These are commented out in Windows NT to avoid conflicts with errno.h. Use the WSA constants instead.
EWOULDBLOCK = GlobalSock.EWOULDBLOCK;  
EINPROGRESS = GlobalSock.EINPROGRESS;  
EALREADY = GlobalSock.EALREADY;  
ENOTSOCK = GlobalSock.ENOTSOCK;  
EDESTADDRREQ = GlobalSock.EDESTADDRREQ;  
EMSGSIZE = GlobalSock.EMSGSIZE;  
EPROTOTYPE = GlobalSock.EPROTOTYPE;  
ENOPROTOOPT = GlobalSock.ENOPROTOOPT;  
EPROTONOSUPPORT = GlobalSock.EPROTONOSUPPORT;  
ESOCKTNOSUPPORT = GlobalSock.ESOCKTNOSUPPORT;  
EOPNOTSUPP = GlobalSock.EOPNOTSUPP;  
EPFNOSUPPORT = GlobalSock.EPFNOSUPPORT;  
EAFNOSUPPORT = GlobalSock.EAFNOSUPPORT;  
EADDRINUSE = GlobalSock.EADDRINUSE;  
EADDRNOTAVAIL = GlobalSock.EADDRNOTAVAIL;  
ENETDOWN = GlobalSock.ENETDOWN;  
ENETUNREACH = GlobalSock.ENETUNREACH;  
ENETRESET = GlobalSock.ENETRESET;  
ECONNABORTED = GlobalSock.ECONNABORTED;  
ECONNRESET = GlobalSock.ECONNRESET;  
ENOBUFS = GlobalSock.ENOBUFS;  
EISCONN = GlobalSock.EISCONN;  
ENOTCONN = GlobalSock.ENOTCONN;  
ESHUTDOWN = GlobalSock.ESHUTDOWN;  
ETOOMANYREFS = GlobalSock.ETOOMANYREFS;  
ETIMEDOUT = GlobalSock.ETIMEDOUT;  
ECONNREFUSED = GlobalSock.ECONNREFUSED;  
ELOOP = GlobalSock.ELOOP;  
ENAMETOOLONG = GlobalSock.ENAMETOOLONG;  
EHOSTDOWN = GlobalSock.EHOSTDOWN;  
EHOSTUNREACH = GlobalSock.EHOSTUNREACH;  
ENOTEMPTY = GlobalSock.ENOTEMPTY;  
EPROCLIM = GlobalSock.EPROCLIM;  
EUSERS = GlobalSock.EUSERS;  
EDQUOT = GlobalSock.EDQUOT;  
ESTALE = GlobalSock.ESTALE;  
EREMOTE = GlobalSock.EREMOTE;  
 
ENOTREADY = GlobalSock.ENOTREADY;  
EVERNOTSUPPORTED = GlobalSock.EVERNOTSUPPORTED;  
ENOTINITIALISED = GlobalSock.ENOTINITIALISED;  
 
Error codes from getaddrinfo()
EAI_AGAIN = GlobalSock.EAI_AGAIN;  
EAI_BADFLAGS = GlobalSock.EAI_BADFLAGS;  
EAI_FAIL = GlobalSock.EAI_FAIL;  
EAI_FAMILY = GlobalSock.EAI_FAMILY;  
EAI_MEMORY = GlobalSock.EAI_MEMORY;  
EAI_NODATA = GlobalSock.EAI_NODATA;  
EAI_NONAME = GlobalSock.EAI_NONAME;  
EAI_SERVICE = GlobalSock.EAI_SERVICE;  
EAI_SOCKTYPE = GlobalSock.EAI_SOCKTYPE;  
 
EAI_NODATA = GlobalSock.EAI_NODATA;  


Condition function value CF_*
WinSock 2 extension -- manifest constants for return values of the condition function
 
CF_ACCEPT = $0000;  
CF_REJECT = $0001;  
CF_DEFER = $0002;  


Shutdown option SD_*
WinSock 2 extension -- manifest constants for shutdown()
 
SD_RECEIVE = GlobalSock.SD_RECEIVE;  
SD_SEND = GlobalSock.SD_SEND;  
SD_BOTH = GlobalSock.SD_BOTH;  


Socket group SG_*
WinSock 2 extension -- data type and manifest constants for socket groups
 
SG_UNCONSTRAINED_GROUP = $01;  
SG_CONSTRAINED_GROUP = $02;  


Provider flag PFL_*
Flag bit definitions for dwProviderFlags */
 
PFL_MULTIPLE_PROTO_ENTRIES = $00000001;  
PFL_RECOMMENDED_PROTO_ENTRY = $00000002;  
PFL_HIDDEN = $00000004;  
PFL_MATCHES_PROTOCOL_ZERO = $00000008;  


Service flag XP1_*
 Flag bit definitions for dwServiceFlags1 */
 
XP1_CONNECTIONLESS = $00000001;  
XP1_GUARANTEED_DELIVERY = $00000002;  
XP1_GUARANTEED_ORDER = $00000004;  
XP1_MESSAGE_ORIENTED = $00000008;  
XP1_PSEUDO_STREAM = $00000010;  
XP1_GRACEFUL_CLOSE = $00000020;  
XP1_EXPEDITED_DATA = $00000040;  
XP1_CONNECT_DATA = $00000080;  
XP1_DISCONNECT_DATA = $00000100;  
XP1_SUPPORT_BROADCAST = $00000200;  
XP1_SUPPORT_MULTIPOINT = $00000400;  
XP1_MULTIPOINT_CONTROL_PLANE = $00000800;  
XP1_MULTIPOINT_DATA_PLANE = $00001000;  
XP1_QOS_SUPPORTED = $00002000;  
XP1_INTERRUPT = $00004000;  
XP1_UNI_SEND = $00008000;  
XP1_UNI_RECV = $00010000;  
XP1_IFS_HANDLES = $00020000;  
XP1_PARTIAL_MESSAGE = $00040000;  


Join leaf option JL_*
WinSock 2 extension -- manifest constants for WSAJoinLeaf()
 
JL_SENDER_ONLY = $01;  
JL_RECEIVER_ONLY = $02;  
JL_BOTH = $04;  


Socket flag WSA_FLAG_*
WinSock 2 extension -- manifest constants for WSASocket()
 
WSA_FLAG_OVERLAPPED = $01;  
WSA_FLAG_MULTIPOINT_C_ROOT = $02;  
WSA_FLAG_MULTIPOINT_C_LEAF = $04;  
WSA_FLAG_MULTIPOINT_D_ROOT = $08;  
WSA_FLAG_MULTIPOINT_D_LEAF = $10;  


Socket IOC option IOC_*
WinSock 2 extension -- manifest constants for WSAIoctl()
 
IOC_UNIX = $00000000;  
IOC_WS2 = $08000000;  
IOC_PROTOCOL = $10000000;  
IOC_VENDOR = $18000000;  


SIO option SIO_*
SIO_ASSOCIATE_HANDLE = IOC_IN or IOC_WS2 or 1;  
SIO_ENABLE_CIRCULAR_QUEUEING = IOC_WS2 or 2;  
SIO_FIND_ROUTE = IOC_OUT or IOC_WS2 or 3;  
SIO_FLUSH = IOC_WS2 or 4;  
SIO_GET_BROADCAST_ADDRESS = IOC_OUT or IOC_WS2 or 5;  
SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT or IOC_WS2 or 6;  
SIO_GET_QOS = IOC_INOUT or IOC_WS2 or 7;  
SIO_GET_GROUP_QOS = IOC_INOUT or IOC_WS2 or 8;  
SIO_MULTIPOINT_LOOPBACK = IOC_IN or IOC_WS2 or 9;  
SIO_MULTICAST_SCOPE = IOC_IN or IOC_WS2 or 10;  
SIO_SET_QOS = IOC_IN or IOC_WS2 or 11;  
SIO_SET_GROUP_QOS = IOC_IN or IOC_WS2 or 12;  
SIO_TRANSLATE_HANDLE = IOC_INOUT or IOC_WS2 or 13;  
 
WinSock 2 extension -- manifest constants for SIO_TRANSLATE_HANDLE ioctl
TH_NETDEV = $00000001;  
TH_TAPI = $00000002;  


Name space NS_*
NS_ALL = (0);  
 
NS_SAP = (1);  
NS_NDS = (2);  
NS_PEER_BROWSE = (3);  
 
NS_TCPIP_LOCAL = (10);  
NS_TCPIP_HOSTS = (11);  
NS_DNS = (12);  
NS_NETBT = (13);  
NS_WINS = (14);  
 
NS_NBP = (20);  
 
NS_MS = (30);  
NS_STDA = (31);  
NS_NTDS = (32);  
 
NS_X500 = (40);  
NS_NIS = (41);  
NS_NISPLUS = (42);  
 
NS_WRQ = (50);  


Resolution flag RES_*
Resolution flags for WSAGetAddressByName() Note these are also used by the 1.1 API GetAddressByName, so leave them around.
 
RES_UNUSED_1 = $00000001;  
RES_FLUSH_CACHE = $00000002;  
RES_SERVICE = $00000004;  


Service type value SERVICE_TYPE_*
Well known value names for Service Types
 
SERVICE_TYPE_VALUE_IPXPORTA = 'IpxSocket'; SERVICE_TYPE_VALUE_IPXPORTW : PWideChar = 'IpxSocket';
 
SERVICE_TYPE_VALUE_SAPIDA = 'SapId'; SERVICE_TYPE_VALUE_SAPIDW : PWideChar = 'SapId';
 
SERVICE_TYPE_VALUE_TCPPORTA = 'TcpPort'; SERVICE_TYPE_VALUE_TCPPORTW : PWideChar = 'TcpPort';
 
SERVICE_TYPE_VALUE_UDPPORTA = 'UdpPort'; SERVICE_TYPE_VALUE_UDPPORTW : PWideChar = 'UdpPort';
 
SERVICE_TYPE_VALUE_OBJECTIDA = 'ObjectId'; SERVICE_TYPE_VALUE_OBJECTIDW : PWideChar = 'ObjectId';
 
SERVICE_TYPE_VALUE_SAPID = SERVICE_TYPE_VALUE_SAPIDA;  
SERVICE_TYPE_VALUE_TCPPORT = SERVICE_TYPE_VALUE_TCPPORTA;  
SERVICE_TYPE_VALUE_UDPPORT = SERVICE_TYPE_VALUE_UDPPORTA;  
SERVICE_TYPE_VALUE_OBJECTID = SERVICE_TYPE_VALUE_OBJECTIDA;  
 
WinSock 2 extension -- WSABUF and QOS struct, include qos.h to pull in FLOWSPEC and related definitions
SERVICETYPE_NOTRAFFIC = $00000000; No data in this direction
SERVICETYPE_BESTEFFORT = $00000001; Best Effort
SERVICETYPE_CONTROLLEDLOAD = $00000002; Controlled Load
SERVICETYPE_GUARANTEED = $00000003; Guaranteed
SERVICETYPE_NETWORK_UNAVAILABLE = $00000004; Used to notify change to user
SERVICETYPE_GENERAL_INFORMATION = $00000005; Corresponds to "General Parameters" defined by IntServ
SERVICETYPE_NOCHANGE = $00000006; Used to indicate that the flow spec contains no change from any previous one
 
SERVICE_IMMEDIATE_TRAFFIC_CONTROL = $80000000; To turn on immediate traffic control, OR this flag with the ServiceType field in teh FLOWSPEC


LUP option LUP_*
LUP_DEEP = $0001;  
LUP_CONTAINERS = $0002;  
LUP_NOCONTAINERS = $0004;  
LUP_NEAREST = $0008;  
LUP_RETURN_NAME = $0010;  
LUP_RETURN_TYPE = $0020;  
LUP_RETURN_VERSION = $0040;  
LUP_RETURN_COMMENT = $0080;  
LUP_RETURN_ADDR = $0100;  
LUP_RETURN_BLOB = $0200;  
LUP_RETURN_ALIASES = $0400;  
LUP_RETURN_QUERY_STRING = $0800;  
LUP_RETURN_ALL = $0FF0;  
LUP_RES_SERVICE = $8000;  
 
LUP_FLUSHCACHE = $1000;  
LUP_FLUSHPREVIOUS = $2000;  


Address info flag AI_*
Flags used in "hints" argument to getaddrinfo()
Note: Under Linux these values may be different
 
AI_PASSIVE = GlobalSock.AI_PASSIVE;  
AI_CANONNAME = GlobalSock.AI_CANONNAME;  
AI_NUMERICHOST = GlobalSock.AI_NUMERICHOST;  
AI_NUMERICSERV = GlobalSock.AI_NUMERICSERV;  
AI_ALL = GlobalSock.AI_ALL;  
AI_ADDRCONFIG = GlobalSock.AI_ADDRCONFIG;  
AI_V4MAPPED = GlobalSock.AI_V4MAPPED;  
AI_NON_AUTHORITATIVE = GlobalSock.AI_NON_AUTHORITATIVE;  
AI_SECURE = GlobalSock.AI_SECURE;  
AI_RETURN_PREFERRED_NAMES = GlobalSock.AI_RETURN_PREFERRED_NAMES;  
AI_FQDN = GlobalSock.AI_FQDN;  
AI_FILESERVER = GlobalSock.AI_FILESERVER;  


Name info flag NI_*
Flags for getnameinfo()
 
NI_NOFQDN = GlobalSock.NI_NOFQDN;  
NI_NUMERICHOST = GlobalSock.NI_NUMERICHOST;  
NI_NAMEREQD = GlobalSock.NI_NAMEREQD;  
NI_NUMERICSERV = GlobalSock.NI_NUMERICSERV;  
NI_DGRAM = GlobalSock.NI_DGRAM;  
 
NI_MAXHOST = GlobalSock.NI_MAXHOST;  
NI_MAXSERV = GlobalSock.NI_MAXSERV;  


Type definitions


See globalsock.pas

Class definitions



Base socket classes

TWinsock2Socket = class(TListObject)
TWinsock2SocketThread = class(TThreadEx)
TWinsock2SocketThreads = class(TObject)
TWinsock2SocketBuffer = class(TObject)
TWinsock2SocketBuffers = class(TObject)

Raw socket (SOCK_RAW) classes

TWinsock2RAWSocket = class(TWinsock2Socket)

Stream socket (SOCK_STREAM) classes

TWinsock2TCPSocket = class(TWinsock2Socket)

Datagram socket (SOCK_DGRAM) classes

TWinsock2UDPSocket = class(TWinsock2Socket)

Raw client classes

TWinsock2RAWClient = class(TWinsock2RAWSocket)

Stream client classes

TWinsock2TCPClient = class(TWinsock2TCPSocket)

Datagram client classes

TWinsock2UDPClient = class(TWinsock2UDPSocket)

Stream server classes

TWinsock2TCPServer = class(TWinsock2TCPSocket)
TWinsock2TCPServerThread = class(TWinsock2SocketThread)
TWinsock2TCPListenerThread = class(TWinsock2SocketThread)
TWinsock2TCPServerThreads = class(TWinsock2SocketThreads)
TWinsock2TCPListener = class(TWinsock2TCPSocket)

Datagram server classes

TWinsock2UDPServer = class(TWinsock2UDPSocket)
TWinsock2UDPServerThread = class(TWinsock2SocketThread)
TWinsock2UDPListenerThread = class(TWinsock2SocketThread)
TWinsock2UDPServerThreads = class(TWinsock2SocketThreads)
TWinsock2UDPServerBuffer = class(TWinsock2SocketBuffer)
TWinsock2UDPServerBuffers = class(TWinsock2SocketBuffers)
TWinsock2UDPListener = class(TWinsock2UDPSocket)


Public variables


None defined

Function declarations



Initialization functions

procedure WS2Init;
Description: To be documented
Note None documented


function WS2Start:Boolean;
Description: To be documented
Note None documented


function WS2Stop:Boolean;
Description: To be documented
Note None documented


procedure WS2AsyncStart(Data:Pointer);
Description: To be documented
Note None documented


Winsock2 functions

function accept( const s: TSocket; addr: PSockAddr; addrlen: PLongint ): TSocket;
Description: To be documented
Note None documented


function accept( const s: TSocket; addr: PSockAddr; var addrlen: Longint ): TSocket;
Description: To be documented
Note None documented


function bind( const s: TSocket; addr: PSockAddr; namelen: Longint ): Longint;
Description: To be documented
Note None documented


function bind( const s: TSocket; var addr: TSockAddr; namelen: Longint ): Longint;
Description: To be documented
Note None documented


function closesocket( const s: TSocket ): Longint;
Description: To be documented
Note None documented


function connect( const s: TSocket; name: PSockAddr; namelen: Longint): Longint;
Description: To be documented
Note None documented


function connect( const s: TSocket; var name: TSockAddr; namelen: Longint): Longint;
Description: To be documented
Note None documented


function ioctlsocket( const s: TSocket; cmd: Longint; var arg: u_long ): Longint;
Description: To be documented
Note None documented


function ioctlsocket( const s: TSocket; cmd: Longint; argp: pu_long ): Longint;
Description: To be documented
Note None documented


function getpeername( const s: TSocket; var name: TSockAddr; var namelen: Longint ): Longint;
Description: To be documented
Note None documented


function getsockname( const s: TSocket; var name: TSockAddr; var namelen: Longint ): Longint;
Description: To be documented
Note None documented


function getsockopt( const s: TSocket; const level, optname: Longint; optval: PChar; var optlen: Longint ): Longint;
Description: To be documented
Note None documented


function getsockopt( const s: TSocket; const level, optname: Longint; optval: Pointer; var optlen: Longint ): Longint;
Description: To be documented
Note None documented


function getsockopt( const s: TSocket; const level, optname: Longint; var optval; var optlen: Longint ): Longint;
Description: To be documented
Note None documented


function htonl(hostlong: u_long): u_long;
Description: To be documented
Note None documented


function htons(hostshort: u_short): u_short;
Description: To be documented
Note None documented


function inet_addr(cp: PChar): u_long;
Description: To be documented
Note None documented


function inet_ntoa(inaddr: TInAddr): PChar;
Description: To be documented
Note As per the Winsock specification, the buffer returned by this function is only guaranteed to be valid until the next Winsock function call is made within the same thread. Therefore, the data should be copied before another Winsock call.


function listen(s: TSocket; backlog: Longint): Longint;
Description: To be documented
Note None documented


function ntohl(netlong: u_long): u_long;
Description: To be documented
Note None documented


function ntohs(netshort: u_short): u_short;
Description: To be documented
Note None documented


function recv(s: TSocket; var Buf; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function recv(s: TSocket; Buf: PChar; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function recv(s: TSocket; Buf: Pointer; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function recvfrom(s: TSocket; Buf: PChar; len, flags: Longint; from: PSockAddr; fromlen: PLongint): Longint;
Description: To be documented
Note None documented


function recvfrom(s: TSocket; Buf: Pointer; len, flags: Longint; from: PSockAddr; fromlen: PLongint): Longint;
Description: To be documented
Note None documented


function recvfrom(s: TSocket; var Buf; len, flags: Longint; var from: TSockAddr; var fromlen: Longint): Longint;
Description: To be documented
Note None documented


function select(nfds: Longint; readfds, writefds, exceptfds: PFDSet; timeout: PTimeVal): Longint;
Description: To be documented
Note All sockets contained by the FDSet must be of the same type


function send(s: TSocket; var Buf; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function send(s: TSocket; Buf: PChar; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function send(s: TSocket; Buf: Pointer; len, flags: Longint): Longint;
Description: To be documented
Note None documented


function sendto(s: TSocket; var Buf; len, flags: Longint; var addrto: TSockAddr; tolen: Longint): Longint;
Description: To be documented
Note None documented


function sendto(s: TSocket; Buf: PChar; len, flags: Longint; addrto: PSockAddr; tolen: Longint): Longint;
Description: To be documented
Note None documented


function sendto(s: TSocket; Buf: Pointer; len, flags: Longint; addrto: PSockAddr; tolen: Longint): Longint;
Description: To be documented
Note None documented


function setsockopt(s: TSocket; level, optname: Longint; const optval; optlen: Longint): Longint;
Description: To be documented
Note None documented


function setsockopt(s: TSocket; level, optname: Longint; optval: PChar; optlen: Longint): Longint;
Description: To be documented
Note None documented


function setsockopt(s: TSocket; level, optname: Longint; optval: Pointer; optlen: Longint): Longint;
Description: To be documented
Note None documented


function shutdown(s: TSocket; how: Longint): Longint;
Description: To be documented
Note None documented


function socket(af, struct, protocol: Longint): TSocket;
Description: To be documented
Note None documented


function gethostbyaddr(addr: Pointer; len, family: Longint): PHostEnt;
Description: To be documented
Note None documented


function gethostbyname(name: PChar): PHostEnt;
Description: To be documented
Note None documented


function gethostname(name: PChar; len: Longint): Longint;
Description: To be documented
Note None documented


function getservbyport(port: Longint; proto: PChar): PServEnt;
Description: To be documented
Note None documented


function getservbyname(name, proto: PChar): PServEnt;
Description: To be documented
Note None documented


function getprotobynumber(proto: Longint): PProtoEnt;
Description: To be documented
Note None documented


function getprotobyname(name: PChar): PProtoEnt;
Description: To be documented
Note None documented


function getaddrinfo(pNodeName, pServiceName: PChar; pHints: PAddrInfo; var ppResult: PAddrInfo): LongInt;
Description: To be documented
Note None documented


procedure freeaddrinfo(ai: PAddrInfo);
Description: To be documented
Note None documented


function getnameinfo(sa: PSockAddr; salen: Integer; host: PChar; hostlen: DWORD; serv: PChar; servlen: DWORD; flags: Integer): Integer;
Description: To be documented
Note None documented


function WSAStartup(wVersionRequired: word; var WSData: TWSAData): Longint;
Description: To be documented
Note None documented


function WSACleanup: Longint;
Description: To be documented
Note None documented


procedure WSASetLastError(iError: Longint); inline;
Description: To be documented
Note None documented


function WSAGetLastError: Longint; inline;
Description: To be documented
Note None documented


function __WSAFDIsSet(s: TSOcket; var FDSet: TFDSet): Bool;
Description: To be documented
Note None documented


function inet_pton(Family: Longint; pszAddrString: PChar; pAddrBuf: Pointer): Longint;
Description: To be documented
Note None documented


function InetPtonA(Family: Longint; pszAddrString: PChar; pAddrBuf: Pointer): Longint;
Description: To be documented
Note None documented


function InetPtonW(Family: Longint; pszAddrString: PWideChar; pAddrBuf: Pointer): Longint;
Description: To be documented
Note None documented


function inet_ntop(Family: Longint; pAddr: Pointer; pStringBuf: PChar; StringBufSize: Longint): PChar;
Description: To be documented
Note None documented


function InetNtopA(Family: Longint; pAddr: Pointer; pStringBuf: PChar; StringBufSize: Longint): PChar;
Description: To be documented
Note None documented


function InetNtopW(Family: Longint; pAddr: Pointer; pStringBuf: PWideChar; StringBufSize: Longint): PWideChar;
Description: To be documented
Note None documented


function WSAhtonl( s : TSocket; hostlong : u_long; var lpnetlong : DWORD ): Longint;
Description: To be documented
Note None documented


function WSAhtons( s : TSocket; hostshort : u_short; var lpnetshort : WORD ): Longint;
Description: To be documented
Note None documented


function WSANtohl( s : TSocket; netlong : u_long; var lphostlong : DWORD ): Longint;
Description: To be documented
Note None documented


function WSANtohs( s : TSocket; netshort : u_short; var lphostshort : WORD ): Longint;
Description: To be documented
Note None documented


function WSAMakeSyncReply(Buflen, Error: Word): Longint;
Description: To be documented
Note None documented


function WSAMakeSelectReply(Event, Error: Word): Longint;
Description: To be documented
Note None documented


function WSAGetAsyncBuflen(Param: Longint): Word;
Description: To be documented
Note None documented


function WSAGetAsyncError(Param: Longint): Word;
Description: To be documented
Note None documented


function WSAGetSelectEvent(Param: Longint): Word;
Description: To be documented
Note None documented


function WSAGetSelectError(Param: Longint): Word;
Description: To be documented
Note None documented


procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet);
Description: To be documented
Note None documented


function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean;
Description: To be documented
Note None documented


procedure FD_SET(Socket: TSocket; var FDSet: TFDSet);
Description: To be documented
Note None documented


procedure FD_ZERO(var FDSet: TFDSet);
Description: To be documented
Note None documented


Winsock2 undocumented functions

function WsControl(Proto:DWORD; Action:DWORD; pRequestInfo:Pointer; var pcbRequestInfoLen:DWORD; pResponseInfo:Pointer; var pcbResponseInfoLen:DWORD):Integer;
Description: To be documented
Note None documented


function getnetbyaddr(addr: Pointer; len, Struct: Integer): PNetEnt;
Description: To be documented
Note None documented


function getnetbyname(name: PChar): PNetEnt;
Description: To be documented
Note None documented


Winsock2 enhanced functions

function WsControlEx(Proto:DWORD; Action:DWORD; pRequestInfo:Pointer; var pcbRequestInfoLen:DWORD; pResponseInfo:Pointer; var pcbResponseInfoLen:DWORD):Integer;
Description: To be documented
Note None documented


RTL text IO functions

function SysTextIOReadChar(var ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform TextIOReadChar function
Note Not intended to be called directly by applications


function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;
Description: Handler for platform TextIOWriteChar function
Note Not intended to be called directly by applications


function SysTextIOWriteBuffer(ABuffer:PChar; ACount:LongInt; AUserData:Pointer):LongInt;
Description: Handler for platform TextIOWriteBuffer function
Note Not intended to be called directly by applications


Winsock2 helper functions

function Winsock2RedirectInput(s:TSocket):Boolean;
Description: Redirect standard input to the socket specified by s
s The socket to redirect input to (or INVALID_SOCKET to stop redirection)
Return True if completed successfully or False if an error occurred
Note Redirects the input of the text file Input which also redirects the input of Read, ReadLn and the standard C library.


function Winsock2RedirectOutput(s:TSocket):Boolean;
Description: Redirect standard output to the socket specified by s
s The socket to redirect output to (or INVALID_SOCKET to stop redirection)
Return True if completed successfully or False if an error occurred
Note Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library.


function Winsock2ErrorToString(AError:LongInt):String;
Description: To be documented
Note None documented


Return to Unit Reference