Difference between revisions of "TWinsock2Socket"
From Ultibo.org
(2 intermediate revisions by the same user not shown) | |||
Line 39: | Line 39: | ||
|- | |- | ||
| <code>FReuseAddress:Boolean;</code> | | <code>FReuseAddress:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FSendSize:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FReceiveSize:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FSendTimeout:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FReceiveTimeout:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FConnectTimeout:Integer;</code> | ||
| | | | ||
|- | |- | ||
Line 147: | Line 168: | ||
| | | | ||
|- | |- | ||
− | | <code>function ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer):Boolean;</code> | + | | <code>function ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer; ALastError:Boolean = True):Boolean;</code> |
| | | | ||
|- | |- | ||
Line 571: | Line 592: | ||
<br /> | <br /> | ||
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;"> | ||
− | <pre style="border: 0; padding-bottom:0px;">function TWinsock2Socket.ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer):Boolean;</pre> | + | <pre style="border: 0; padding-bottom:0px;">function TWinsock2Socket.ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer; ALastError:Boolean = True):Boolean;</pre> |
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a socket address structure allocated by AllocateAddress or AddressToSockAddr</div> | <div style="font-size: 14px; padding-left: 12px;">'''Description:''' Free a socket address structure allocated by AllocateAddress or AddressToSockAddr</div> | ||
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> |
Latest revision as of 04:33, 23 March 2023
Return to Unit Winsock2
Description
To be documented
Class definitions
TWinsock2Socket = class(TListObject)
Note: Base Socket classes | |
public
| |
constructor Create;
|
|
private
| |
FBoundPort:Word;
|
|
FBoundAddress:String;
|
|
FReuseAddress:Boolean;
|
|
FSendSize:Integer;
|
|
FReceiveSize:Integer;
|
|
FSendTimeout:Integer;
|
|
FReceiveTimeout:Integer;
|
|
FConnectTimeout:Integer;
|
|
procedure SetFamily(AFamily:Integer); virtual;
|
|
procedure SetSocketType(ASocketType:Integer); virtual;
|
|
procedure SetProtocol(AProtocol:Integer); virtual;
|
|
procedure SetBoundPort(ABoundPort:Word);
|
|
procedure SetBoundAddress(const ABoundAddress:String); virtual;
|
|
procedure SetReuseAddress(AReuseAddress:Boolean);
|
|
function GetLocalPort:Word;
|
|
function GetLocalHost:String;
|
|
function GetLocalAddress:String;
|
|
function GetLocalAddresses:TStrings;
|
|
function GetSendSize:Integer;
|
|
procedure SetSendSize(ASize:Integer);
|
|
function GetReceiveSize:Integer;
|
|
procedure SetReceiveSize(ASize:Integer);
|
|
function GetSendTimeout:Integer;
|
|
procedure SetSendTimeout(ATimeout:Integer);
|
|
function GetReceiveTimeout:Integer;
|
|
procedure SetReceiveTimeout(ATimeout:Integer);
|
|
function GetConnectTimeout:Integer;
|
|
procedure SetConnectTimeout(ATimeout:Integer);
|
|
protected
| |
FHandle:TSocket;
|
|
FFamily:Integer;
|
|
FSocketType:Integer;
|
|
FProtocol:Integer;
|
|
FLastError:LongInt;
|
|
function GetBroadcastAddress:String;
|
|
function AllocateFamily:Boolean; virtual;
|
|
function AllocateAddress(var ALength:Integer):PSockAddr;
|
|
function ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer; ALastError:Boolean = True):Boolean;
|
|
function AllocateBoundAddress(var ALength:Integer):PSockAddr;
|
|
function AllocateSocket(ASocketType:Integer):TSocket;
|
|
function Bind:LongInt;
|
|
function SockAddrToPort(ASockAddr:PSockAddr; ALength:Integer):Word;
|
|
function SockAddrToAddress(ASockAddr:PSockAddr; ALength:Integer):String;
|
|
function PortToSockAddr(APort:Word; ASockAddr:PSockAddr; ALength:Integer):Boolean;
|
|
function AddressToSockAddr(const AAddress:String; var ALength:Integer):PSockAddr;
|
|
public
| |
property Handle:TSocket read FHandle;
|
|
property Family:Integer read FFamily write SetFamily;
|
|
property SocketType:Integer read FSocketType write SetSocketType;
|
|
property Protocol:Integer read FProtocol write SetProtocol;
|
|
property LastError:LongInt read FLastError;
|
|
property BoundPort:Word read FBoundPort write SetBoundPort;
|
|
property BoundAddress:String read FBoundAddress write SetBoundAddress;
|
|
property ReuseAddress:Boolean read FReuseAddress write SetReuseAddress;
|
|
property LocalPort:Word read GetLocalPort;
|
|
property LocalHost:String read GetLocalHost;
|
|
property LocalAddress:String read GetLocalAddress;
|
|
property LocalAddresses:TStrings read GetLocalAddresses;
|
|
property SendSize:Integer read GetSendSize write SetSendSize;
|
|
property ReceiveSize:Integer read GetReceiveSize write SetReceiveSize;
|
|
property SendTimeout:Integer read GetSendTimeout write SetSendTimeout;
|
|
property ReceiveTimeout:Integer read GetReceiveTimeout write SetReceiveTimeout;
|
|
property ConnectTimeout:Integer read GetConnectTimeout write SetConnectTimeout;
|
|
function Connected:Boolean; virtual;
|
|
function Shutdown:Boolean; virtual;
|
|
function Disconnect:Boolean; virtual;
|
|
function CloseSocket:Boolean; virtual;
|
|
function ResolveHost(const AHost:String):String;
|
|
function ResolveFamily(const AAddress:String):Integer;
|
|
function ResolveAddress(const AAddress:String):String;
|
|
function ResolveHostEx(const AHost:String; AFamily:Integer; AAll:Boolean):TStrings;
|
Function declarations
constructor TWinsock2Socket.Create;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetFamily(AFamily:Integer);
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetSocketType(ASocketType:Integer);
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetProtocol(AProtocol:Integer);
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetBoundPort(ABoundPort:Word);
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetBoundAddress(const ABoundAddress:String);
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetReuseAddress(AReuseAddress:Boolean);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetLocalPort:Word;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetLocalHost:String;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetLocalAddress:String;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetLocalAddresses:TStrings;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetSendSize:Integer;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetSendSize(ASize:Integer);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetReceiveSize:Integer;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetReceiveSize(ASize:Integer);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetSendTimeout:Integer;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetSendTimeout(ATimeout:Integer);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetReceiveTimeout:Integer;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetReceiveTimeout(ATimeout:Integer);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetConnectTimeout:Integer;
Description: To be documented
Note | None documented |
---|
procedure TWinsock2Socket.SetConnectTimeout(ATimeout:Integer);
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.GetBroadcastAddress:String;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.AllocateFamily:Boolean;
Description: Check Family and Bound Address, normalise as needed
Note | None documented |
---|
function TWinsock2Socket.AllocateAddress(var ALength:Integer):PSockAddr;
Description: Allocate s socket address structure for the current family
Note | None documented |
---|
function TWinsock2Socket.ReleaseAddress(var ASockAddr:PSockAddr; var ALength:Integer; ALastError:Boolean = True):Boolean;
Description: Free a socket address structure allocated by AllocateAddress or AddressToSockAddr
Note | None documented |
---|
function TWinsock2Socket.AllocateBoundAddress(var ALength:Integer):PSockAddr;
Description: Allocate a socket address structure for the bound address and port
Note | None documented |
---|
function TWinsock2Socket.AllocateSocket(ASocketType:Integer):TSocket;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.Bind:LongInt;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.SockAddrToPort(ASockAddr:PSockAddr; ALength:Integer):Word;
Description: Convert a socket adress structure to a numeric port
Note | None documented |
---|
function TWinsock2Socket.SockAddrToAddress(ASockAddr:PSockAddr; ALength:Integer):String;
Description: Convert a socket address structure to a numeric address
Note | None documented |
---|
function TWinsock2Socket.PortToSockAddr(APort:Word; ASockAddr:PSockAddr; ALength:Integer):Boolean;
Description: Convert a numeric port to a socket adress structure
Note | None documented |
---|
function TWinsock2Socket.AddressToSockAddr(const AAddress:String; var ALength:Integer):PSockAddr;
Description: Convert a numeric address to a socket address structure
Note | None documented |
---|
function TWinsock2Socket.Connected:Boolean;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.Shutdown:Boolean;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.Disconnect:Boolean;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.CloseSocket:Boolean;
Description: To be documented
Note | None documented |
---|
function TWinsock2Socket.ResolveHost(const AHost:String):String;
Description: Resolve a hostname to a numeric address
Note | None documented |
---|
function TWinsock2Socket.ResolveFamily(const AAddress:String):Integer;
Description: Resolve a numeric address to an address family
Note | None documented |
---|
function TWinsock2Socket.ResolveAddress(const AAddress:String):String;
Description: Resolve a numeric address to a hostname
Note | None documented |
---|
function TWinsock2Socket.ResolveHostEx(const AHost:String; AFamily:Integer; AAll:Boolean):TStrings;
Description: Resolve a hostname to a numeric address or addresses in the family specified or all families
Note | All may include addresses that this host cannot connect to such as IPv6 if this host does not have a global IPv6 address |
---|
Return to Unit Reference