Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » System » TCP IP » TcpIp_Connect


Module: FoundationLite

Connects as a client to a remote TCP server socket.

Name Type Range Description
inHost String The hostname or IP address to connect to.
inPort Integer 7 - 65535 TCP port of host to connect to.
inTimeout Integer* 500 - Timeout in milliseconds, block if not specified.
inKeepAliveTime Integer* 2000 - When specified activates Tcp/Ip keep alive on new socket with given idle time.
outSocket SocketId? Connected socket ID.


This filter connects to a listening TCP/IP socket.

The inTimeout input specifies the longest possible waiting time, in milliseconds, for the connection to be accepted. When no timeout is specified (set to Auto), the execution is blocking. When filter execution is terminated by timeout condition no socket is returned (Nil is returned on outSocket output) and the operation can be retried later. When remote host can not be found or when remote host is not listening on specified port the connection attempt is repeated until timeout expires. This filter can block for significantly longer than the timeout specified because its work is not cancelled in the middle of a single connection attempt.

Every socket created and returned by this filter must be explicitly closed with TcpIp_Close filter when it is not needed any more.

inKeepAliveTime can be used to enable Keep-Alive mechanism on newly established connection with the host.

Keep-Alive is a mechanism built in the TCP/IP stack, that can be helpful with detecting broken connection in systems with long communication idle periods or with communication in one direction only. When enabled, operating system will send additional control packets to check state of the connection. inKeepAliveTime input specifies the time, in milliseconds, of connection idle state after which connection state will be checked. The exact time after which connection broken state will be detected is system dependent.

The inHost parameter can be entered as a DNS host name or IP address. The time necessary to connect can vary, for example subsequent connections to the same host may be faster because of cached DNS information.

In case of failure for reasons other than timeout, IoError is raised.


  • Set inHost to an IP address or an url of the server you want to connect to.
  • Set inPort to the same port number that the other side of communication will be listening on.
  • Set inTimeout if you want the filter to abort trying to connect after a predefined time.


Description of usage of this filter can be found in examples and tutorial: IO HTTP Image Download, TcpIp Shoutbox Client.


User manual

For more information about using this filter, please follow the link: Using TCP/IP Communication.

Complexity Level

This filter is available on Basic Complexity Level.

Disabled in Lite Edition

This filter is disabled in Lite Edition. It is available only in full, Adaptive Vision Studio Professional version.

See Also

  • TcpIp_Accept – Accepts a connection from a remote client.
  • TcpIp_Close – Close a connected TCP socket gracefully.