tcpOpen()

Opens the connection to a TCP/IP server socket.

Synopsis

int tcpOpen(string host, unsigned port [, time timeout]);

Parameters

Parameter Description
host Name of the host, to which the function establishes a connection, for example, eiwnt094
port Number of the port, for example, 8080
timeout Timeout for establishing the connection. This parameter is optional. Default is 5 seconds.

Return value

Descriptor of the opened TCP/IP connection.

Use the function getLastError() to test if the function was executed successfully.

In case of error -1 will be returned.

Error

Missing or wrong arguments.

The TCP/IP server socket has already been opened (Close with tcpClose()).

Description

Opens the connection to a TCP/IP Server socket.

You can open up to 255 connections at the same time.

Example

main()
{
  dyn_errClass err;
  int open;
  unsigned port;
  port=120;
  open=tcpOpen("eiwnt094", port);
  err=getLastError();
  DebugN(open);
  DebugN(err);
}

Assignment

Communication functions

Availability

CTRL