Topic Path: Symbol Reference > Classes > TIdStackBSDBase Class > TIdStackBSDBase Methods > NewSocketHandle Method
TIdStackBSDBase.NewSocketHandle Method

Creates a new socket handle that is bound to specific socket type and protocol.

function NewSocketHandle(
    const ASocketType: TIdSocketType; 
    const AProtocol: TIdSocketProtocol; 
    const AIPVersion: TIdIPVersion = ID_DEFAULT_IP_VERSION; 
    const AOverlapped: Boolean = False
): TIdStackSocketHandle; override;
Socket type (stream or datagram).
Protocol to use for the socket handle.
IP address family for the IP address.
Indicates overlapped IO is permitted on the socket handle. 

TIdStackSocketHandle - Socket handle created with the specified attributes,

NewSocketHandle is an overridden TIdStackSocketHandle function that implements the method used to access the Socket() API for the protocol stack implementation. 

ASocketType indicates the TIdSocketType value to use as the socket type for the newly created socket handle. 

AProtocol indicates the TIdSocketProtocol value to use as the protocol for the newly created socket handle. 

AOverlapped indicates that overlapped IO operations are permitted on the socket handle. 

NewSocketHandle checks that the socket handle does not contain an invalid value, and sets the return value to the newly created socket handle. 

For stream sockets, call Connect before reading or writing with the socket handle. Call Disconnect to close the connection on the socket handle. 

For datagram sockets, use SendTo or ReceiveFrom to send or receive datagrams. If Connect is called for a datagram socket, use Send and Receive to send or receive datagrams.

Copyright 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved.
Post feedback to the Indy Docs Newsgroup.