Connects to a remote listening socket.
Syntax
Result = SRP_TcpClient(Object, "CONNECT", Address, Port)
Returns
Returns 1 if connection was successfully made, 0 otherwise.
Parameters
Parameter | Description |
---|---|
Address | Param1 should be set to the TCP/IP address. This may be a DNS address or IP number. |
Port | The port through which to make the connection. This must match the port on which the remote socket is listening. |
Remarks
The CONNECT service is the first thing you call to make the connection. The Object parameter is an output parameter and will be set to the new connection's handle if it succeeds. Thereafter, you will pass that handle to other services to send data and close the socket.
Example
// Connect to a local socket and then close TcpClientHandle = 0 If SRP_TcpClient(TcpClientHandle, "CONNECT", "127.0.0.1", "7777") then SRP_TcpClient(TcpClientHandle, "CLOSE") end