#include <rtl.h>
int send (
int sock, /* Socket descriptor */
const char *buf, /* Pointer to a buffer with data */
int len, /* Length of data in bytes */
int flags); /* Message flags */
Description
The send function is used to send data on an already
connected socket. This function is normally used to send a
reliable, ordered stream of data bytes on a SOCK_STREAM socket
type. It can also be used to send datagrams on a
SOCK_DGRAM socket types.
The argument sock specifies a socket descriptor returned
from a previous call to socket.
The argument buf is a pointer to the application data
buffer containing data to transmit. The buffer data length is not
limited in size. If the data length is too large for one packet, the
send function will fragment the data and send it in
several successive data packets:
In blocking mode, which is enabled if the system detects RTX
environment, this function returns after the data has been
successfully transmitted.
In non blocking mode, the function returns immediately without
blocking the system. Return value represents the numbytes
sent, which can be less than len, if the data can not be
transmitted in one packet.
The argument len specifies the length of data in bytes.
The argument flags specifies the message flags:
Flag
Description
MSG_DONTWAIT
The function returns with error code SCK_EWOULDBLOCK
or numbytes sent instead of blocking the socket.
The send function is in the RL-TCPnet library. The
prototype is defined in rtl.h.
note
You must call the socket function before any other
function calls to the BSD socket.
If a negative number is returned, it represents an error
code.
Return Value
The send function returns the result code:
numbytes
The total number of bytes successfully sent (a positive
number).
SCK_EINVALID
The socket identified with sock is invalid, or in invalid
state.
SCK_EINVALIDPARA
The function parameters are invalid or not supported.
SCK_EWOULDBLOCK
The function would block, and the socket is set to non blocking
mode.
SCK_ECLOSED
Remote end point has closed the connection.
SCK_ERROR
The function failed due to error in underlying native TCP/UDP
socket.
SCK_ELOCKED
The socket is locked by another task in RTX
environment.
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.