Internet Direct (Indy) Version 9.0.1 Beta
TIdSocketHandle.AllocateSocket
Creates a socket descriptor.

procedure AllocateSocket(const ASocketType: Integer; const AProtocol: Integer);
Parameters
const ASocketType: Integer = Id_SOCK_STREAM
Socket family. Default is Id_SOCK_STREAM.

const AProtocol: Integer = Id_IPPROTO_IP
Protocol family. Default is Id_IPPROTO_IP.

Description
AllocateSocket is a procedure that allocates a socket descriptor of the desired socket type and Internet protocol family as specified in the parameters.

ASocketType determines address family used for the connection, and indicates the valid protocol family options for the socket type. The following socket types are supported:

AProtocol identifies the Internet protocol to be used for the given socket type. Only a single protocol exists to support a particular socket type using a given address format. The following protocol families are supported:

AllocateSocket will call CloseSocket if the socket handle is already allocated.

AllocateSocket will set HandleAllocated to True to reflect the state of the socket handle.