soSend (Function) |
Top Previous Next |
The soSend function transmits data on a socket. When the function returns success, this does not mean that the data is delivered and received by the recipient; only that the data was sent.
On a blocking socket, the function will not return until the data is sent. With a non-blocking socket, if the data do not fit into the send buffer, the function will return -4.
For a connection-based socket (type _SO_TYPE_STREAM), the socket must first be connected by the soConnect or soAccept functions before this function can be called. For a connectionless socket (type _SO_TYPE_DGRAM), the destination given by the address parameter. The address parameter can be ignored if the soConnect function is used to set the destination. Also, for a connectionless socket, care must be taken to not exceed the maximum packet size of the underlying protocol. If the data is too large to pass through atomically, no data is is sent and an error is returned.
Input: socket : SYSHANDLE Handle to the socket.
data : PTR Address of the buffer that contains the data to be sent.
size : DINT Number of bytes to send from the buffer.
address : STRING The destination address. The address is ignored if a connection is established.
Output: sent : DINT The number of bytes sent.
Returns: INT
Declaration: FUNCTION soSend : INT;
Example:
|