www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


sendto_bsd

Transmit a UDP datagram.

int far sendto_bsd ( int sd,
                     const char far * bufptr,
                     int buflen,
                     int flags,
                     const struct sockaddr far * toPtr,
                     int toLength ) ;

Parameters

sd

Socket descriptor

bufptr

Data to be sent.

buflen

Number of bytes to send.

flags

Wait option:
  • MSG_BLOCKING - Wait for data send to complete.
  • MSG_DONTWAIT - Don't wait for data send to complete.

toPtr

IP address information datagram destination.   Pointer to a sockaddr_in (IPv4) or sockaddr_in6 (IPv6) data structure set by caller prior to call.

toLength

Size of object pointed to by toPtr .

Return Value

-1: Failure, error code is available using get_socketerror()
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) 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) 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.

If the compilation switch

     #define BSD44_SOCKET_API_STYLE

is set as a global define in the user application prior to including the Beck C-library header files, the sendto() call can be used in BSD 4.4 compatible style with the parameters specified above.   Using this switch the CLIB TCPIP_Socket.H redefines sendto() to sendto_bsd() .

See Also

RTOS API

On the first call, this library function invokes a software interrupt which modifies the code at the calling site inside your application program.   A direct FAR JMP into the @CHIP-RTOS-x86 implementation for this function is installed so that on return and on any subsequent calls to this API this dynamic link reaches the function's implementation directly.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.36V1.36

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.20

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document