System.Win.ScktComp.TCustomWinSocket.InitSocket

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function InitSocket(const Name, Address, Service: string; Port: Word;  Client: Boolean): TSockAddrIn;

C++

sockaddr_in __fastcall InitSocket(const System::UnicodeString Name, const System::UnicodeString Address, const System::UnicodeString Service, System::Word Port, bool Client);

Properties

Type Visibility Source Unit Parent
function protected
System.Win.ScktComp.pas
System.Win.ScktComp.hpp
System.Win.ScktComp TCustomWinSocket

Description

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

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.

See Also