@CHIP-RTOS C Library - TCP/IP API
sendto
Transmit a datagram. int sendto ( int sd, const char far *bufptr, int bufLen,
int flags, const struct sockaddr far *toPtr,
int *error ); Parameters
sd
- Socket descriptor.
bufptr
- Pointer to output buffer containing
characters to be transmitted.
bufLen
- Maximum characters to output from bufptr
.
flags
- Wait option:
- MSG_BLOCKING
- Wait for data send to complete.
- MSG_DONTWAIT
- Don't wait for data send to complete.
toPtr
- Data destination, pointer to a
sockaddr_in
(IPv4) or
sockaddr_in6
(IPv6, SC1x3/SC2x only!
) data structure.
error
- Output parameter: Failure
code, 0 on success.
Return Value
- -1: Failure, see error value reported
otherwise: Count of bytes transfered into the socket send queue.
Comments
- This API function applies only to UDP sockets.
This function will output up to bufLen
bytes from the buffer
at bufptr
to the IP address specified by the
sockaddr_in
(IPv4) structure or
the sockaddr_in6
(IPv6, SC1x3/SC2x only!
) structure referenced by the
toPtr
parameter.
This function's prototype takes a pointer to the
generic type sockaddr
for its toPtr
parameter, for compatibility between IPv4 and
IPv6 protocols. The pointer to the sockaddr_in
(IPv4)
or sockaddr_in6
(IPv6, SC1x3/SC2x only!
) data structure
which is actually used should be cast to a sockaddr
type
pointer to avoid compiler warnings, "Suspicious pointer conversion".
The MSG_BLOCKING
mode will not work if the socket has
been put into non-blocking mode using the
Set_Blocking_Mode API.
SC1x3/SC2x Comments- The actual library function reached here is named
sendto_ipstackV2
(when neither of the compilation
switches discussed below are used). The name change
occurs due to a macro in the library header file.
This legacy version of sendto()
specified here is not compatible
to the BSD 4.4 Socket API. The sendto()
function can be used
in BSD 4.4 compatible mode if the compilation switch
#define BSD44_SOCKET_API_STYLE
is defined in the user application prior to including the Beck C-Library
header files. Using this switch the C-Library TCPIP_Socket.H include
file redefines sendto()
to
sendto_bsd(). The parameters
to sendto_bsd()
are identical to the parameters of the BSD4.4
socket sendto()
function.
The sendto_bsd()
method uses dynamical linking, so therefore
executes faster than this legacy API's sofware interrupt method. The
compilation switch
#define TCPIP_DYN_LINK_SOCK
may be defined in the user application prior to including the Beck C-Library
header files to implement this legacy sendto()
method using
the faster sendto_bsd()
dynamic linked API.
The first compilation switch takes precedence. This second compilation
option, TCPIP_DYN_LINK_SOCK
will be not affect this API
when the first option (BSD44_SOCKET_API_STYLE
) is defined.
See Also
RTOS API
- This library function invokes a RTOS software interrupt.
Refer to this RTOS API function's
documentation
for more details.
Supported since or modified in @CHIP-RTOS version-
| SC12 | SC13 | SC11 | SC1x3 | SC2x |
-
| V1.00 | V1.00 | V1.00 | V0.90 | V1.00 |
This API List
List of C Libraries
@CHIP-RTOS Main Index
End of document
|