Sends data through the connection.

Syntax

SRP_TcpClient(Object, "SEND", Data)

Returns

Always returns 1.

Parameters

ParameterDescription
DataThe data to be sent to the remote server.

Remarks

The SEND service sends a string of data to the remote server. While the call is simple, using it correctly is not. You must always keep in mind that the data you send is treated as an array of bytes. Therefore, if the server on the other end is expecting a 32-bit integer value, you must send four bytes (or chars) that accurately represent that data. If the server on the other end is expecting a string, you will likely need to first send the length of the string first, followed by the string itself. It all depends on the TCP/IP protocol employed by the server.

If you are connected to the SRP Engine Service, you SEND_SES instead, which sends the string's length to the service prior to sending the string itself.

Example

// Connect to a local socket, send data, and then close 
TcpClientHandle = 0 
If SRP_TcpClient(TcpClientHandle, "CONNECT", "127.0.0.1", "7777") then 
    
    // Send the string length in binary 
    SRP_TcpClient(TcpClientHandle, "SEND", \0000000D\) 
    
    // Send the string 
    SRP_TcpClient(TcpClientHandle, "SEND", "Hello, World!") 
    
    // Close 
    SRP_TcpClient(TcpClientHandle, "CLOSE") 
end