RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomWinSocket.InitSocket Method

Generates a windows Internet socket address structure from a description of the desired socket port.

Pascal
function InitSocket(const Name: string; const Address: string; const Service: string; Port: Word; Client: Boolean): TSockAddrIn;
C++
__fastcall TSockAddrIn InitSocket(const AnsiString Name, const AnsiString Address, const AnsiString Service, Word Port, Boolean Client);

Applications can not call InitSocket. It is called by the Open or Listen method to obtain a Windows Internet socket address structure for the parameters obtained from a socket component. 

The Name parameter is the host name for the socket.The Address parameter is the IP address. The Service parameter is the service for which the socket is to used. The Port parameter is the port number for the socket. The Client parameter indicates whether the socket address structure is to be used by a client socket to describe the destination of a connection or by a server socket to describe the listening connection. 

The host portion of the Windows Internet socket address is obtained from the host name if it is given. Otherwise the Address parameter is used. If Client is true, either the Name or the Address parameter must be specified. If Client is false, they may both be left blank to specify a server that listens on multiple addresses. 

If port number for the Windows Internet socket address is obtained from the Service parameter if it is given. Otherwise, the Port parameter is used. One of these two parameters must be specified. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!