TCPSockets

For examples of how to use this component see:

Open(Host,Port,TimeOut)

Description Opens a TCP connection to a host.
Arguments
[in] HostThe FQDN or IP of the host.
[in] PortThe port to which a connection will be attempted.
[in] TimeOutThe number of SECONDS that the system will wait for the connection to be established, before giving up.
Return Value
  • 0 - Success.
  • 1 - Failure during select statement (GetLastError should offer more info).
  • 2 - Failure during select statement (GetLastError should offer more info).
  • 3 - Failure during select statement (GetLastError should offer more info).
  • 4 - Could not resolve host.
  • 5 - Error during connect (GetLastError should offer more info).

Close()

Description Disconnects the TCP socket.
Arguments
None
Return Value Zero indicates success, any other value indicates failure.

Send(SendData, TimeOut)

Description Sends data to the host.
Arguments
[in] SendDataThe data to be sent.
[in] TimeOutThe number of SECONDS to allow for the data to be sent.
Return Value
  • 0 - Success.
  • 1 - Send failure (GetLastError should offer more info).
  • 2 - Failure during select statement (GetLastError should offer more info).

Recv(RecvData,TimeOut)

Description Receives data from the connection.
Arguments
[out] RecvDataThe data that has been received.
[in] TimeOutThe number of SECONDS that will be waited. If a carriage return is detected in the line the object will return. If this does not happen within the timeout period, then the method will also return.
Return Value
  • 0 - Success.
  • 1 - No data was received in the Timeout period.
  • 2 - Failure during select statement (GetLastError should offer more info).
  • 3 - Some data was received in the Timeout period, but the Carriage Return character was not found.

GetLastError(Description)

Description
Arguments
[out] Description
Return Value

Copyright (c) Warren Flemmer 2006www.net-probe.com