open

open();

The open method of the TcpIpConnection class establishes a connection to a remote application and returns when the connection is established.

Use the name property of the Connection class to define the name or the IP address of the TCP/IP target host used when opening a TCP/IP connection using the open or openAsynch method. The name property, if not an IP address, must be specified in the local HOSTS file or be defined on the Domain Name Service (DNS) node before executing the open or openAsynch method.

Use the port property to define the target service port when using the open or openAsynch method or to define the listen port when using the listen or listenAsynch method.

The open method can be called only when the value of the Connection class state property is Disconnected (0).

The value of the Connection class state property changes to Connected (2) when the connection is open.

The code fragment in the following example shows the use of the open method.

if bOpen.value = true then
    self.tcp.open;
elseif bListen.value = true then
    statusLine1.caption := "Listening";
    self.tcp.listen;
else
    self.tcp.close;
endif;