SOC_Write
SOC_Send
SOC_SendTo

C Specification

#include <nitroWiFi/soc.h>
int SOC_Write  ( int s, const void* buf, int len );
int SOC_Send   ( int s, const void* buf, int len, int flags );
int SOC_SendTo ( int s, const void* buf, int len, int flags, const void* sockTo );

Arguments

s Socket descriptor.
buf Pointer to the buffer that stores the message to send.
len Length of message to send (bytes). If the message is too long and cannot be sent with the protocol in use, SOC_Send() fails and no data is sent.
flags Message transmission type. flags is 0 or the logical OR of the following values. (Only with SOC_SOCK_STREAM stream sockets.)
SOC_MSG_DONTWAIT Performs non-blocking processing. If there is no free space, SOC_EWOULDBLOCK is returned.

Note: Only SOC_MSG_DONTWAIT is supported.

sockTo The pointer to the socket address structures (SOCSockAddr andSOCSockAddrIn) that store the endpoint addresses.
If the socket is in connectionless mode, SOC_SendTo() sends the message to the address specified by sockTo. If the socket is in connection mode, sockTo is ignored.

Return Values

1 or higher Number of bytes in sent message. If SOC_O_NONBLOCK is set in the socket descriptor, the return value may be smaller than len (Short count).
0 Failed.
SOC_EINVAL Invalid processing.
SOC_EMSGSIZE The size is too large to be sent.
SOC_ENETRESET Socket library is not initialized.
SOC_ENOTCONN Not connected.
SOC_EWOULDBLOCK Cannot execute until the requested operation is blocked. (SOC_O_NONBLOCK has been set to the socket descriptor (or the SOC_MSG_DONTWAIT flag has been designated), and there is no free space in the send buffer to copy the message.)

Note: Additional errors may be generated and returned in future library releases. Treat all negative return values as general errors.

Description

SOC_Write(), SOC_Send() and SOC_SendTo() send messages through the specified socket.

SOC_Write() is the same as SOC_Send(), except that flags is not set.

SOC_Write(), SOC_Send() and SOC_SendTo() will block if there is no space in the socket's send buffer, unless the socket descriptor has been set to non-blocking mode using the SOC_Fcntl() function.

See Also

SOCSockAddr, SOC_Fcntl

Revision History

12/12/2005 Modified Description and Return Values.
9/13/2005 Initial version.