Embedded TCP/IP stack
4.7.0
|
fnet_ssize_t fnet_socket_send | ( | fnet_socket_t | s, |
const void * | buf, | ||
fnet_size_t | len, | ||
fnet_flag_t | flags | ||
) |
Sends the data on a connected socket.
s | Descriptor, identifying a connected socket. |
buf | Buffer containing the data to be transmitted. |
len | Length of the data in buf . |
flags | Optional flag specifying the way in which the call is made. It can be constructed by using the bitwise OR operator with any of the values defined by the fnet_msg_flags_t. |
len
.For stream-oriented sockets (SOCK_STREAM), the number of actually sent bytes can be between 0
and the requested length, depending on buffer availability on both client and server machines.
For message-oriented sockets (SOCK_DGRAM), care must be taken not to exceed the maximum datagram size, which can be obtained by using the fnet_socket_getopt() to retrieve the value of the socket option SO_SNDBUF. If the data is too long to pass atomically through the underlying datagram protocol, the error FNET_ERR_MSGSIZE is returned and no data is transmitted.
Calling the fnet_socket_send() with a zero len
parameter is permissible. In such cases, the fnet_socket_send() will return zero as a valid value, and for message-oriented sockets (SOCK_DGRAM) a zero-length transport datagram is sent.
The flags
parameter can be used to influence the behavior of the function invocation beyond the options specified for the associated socket.