SockSend

The SockSend() call sends data to a connected socket.

Syntax:

>>--SockSend(socket, data--+-----------+--)------------------------------><
                           +--, flags--+

where:

socket

is the socket descriptor.

data

is the name of a Rexx variable containing the data to be transmitted.

flags

is a blank delimited list of options:

MSG_OOB

sends out-of-band data to sockets that support SOCK_STREAM communication.

MSG_DONTROUTE

turns on the SO_DONTROUTE option for the duration of the send operation. This option is usually only used by diagnostic or routing programs.

SockSend() sends data to a connected socket with descriptor socket. For information on how to use SockSend() with datagram and raw sockets, see Datagram or raw sockets.

If the socket does not have enough buffer space to hold the data to be sent, the SockSend() call blocks unless the socket is placed in nonblocking mode. See SockIoctl() for a description of how to set the nonblocking mode. Use the SockSelect() call to determine when it is possible to send more data.

Return values:

If successful, the number of bytes of the socket with descriptor socket that is added to the send buffer is returned. Successful completion does not imply that the data has already been delivered to the receiver.

The return value -1 indicates that an error was detected on the sending side of the connection. You can get the specific error code SockSock_Errno() or SockPSock_Errno(). Possible values are:

ENOTSOCK

socket is not a valid socket descriptor.

EINTR

Interrupted system call.

EINVAL

Invalid argument.

ENOBUFS

There is no buffer space available to send the message.

EWOULDBLOCK

socket is in nonblocking mode, the data cannot be sent without blocking, or the SO_SNDTIMEO option has been set for socket and the timeout expired before any data was sent.

Note: SockSend() interfaces with the C function send().