RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TCustomWinSocket.Open Method

Opens a connection to a remote socket.

Pascal
procedure Open(const Name: string; const Address: string; const Service: string; Port: Word; Block: Boolean = True);
C++
__fastcall Open(const AnsiString Name, const AnsiString Address, const AnsiString Service, Word Port, Boolean Block = True);

Client socket components call Open to open a connection to a server socket. 

Open creates the Windows socket that will connect to the server socket, and generates an OnSocketEvent of type seLookup. After the OnSocketEvent, Open binds the Windows Internet socket address derived from the parameters to the socket, locating the server socket. Open then generates an OnSocketEvent of type seConnecting. When the server socket accepts the connection, Open completes the connection to the server socket. Then it generates an OnSocketEvent of type seConnect. After the OnSocketEvent, the Connected property is set to true. 

The Name, Address, Service, and Port parameters are taken from the Host, Address, Service and Port properties of the client socket component. 

Block indicates whether the socket can look up the information it needs to establish a connection asynchronously. When Block is true, the socket blocks execution for each lookup instead of retrieving information about the connection using asynchronous notifications. 

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!