From RAD Studio API Documentation
Jump to: navigation, search


procedure Open(const Name, Address, Service: string; Port: Word; Block: Boolean = True);


void __fastcall Open(const System::UnicodeString Name, const System::UnicodeString Address, const System::UnicodeString Service, System::Word Port, bool Block = true);


Type Visibility Source Unit Parent
System.Win.ScktComp TCustomWinSocket


Opens a connection to a remote socket.

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.

See Also