SENDTO

SENDTO is similar to SEND, except that it includes the destination address parameter.

You can use the destination address on the SENDTO macro to send datagrams on a UDP socket that is connected or not connected.

For datagram sockets, the SENDTO macro sends the entire datagram if the datagram fits into the buffer.

For stream sockets, data is processed as streams of information with no boundaries separating the data. For example, if a program is required to send 1000 bytes, each SENDTO macro call can send any number of bytes, up to the entire 1000 bytes, with the number of bytes sent returned in RETCODE. Therefore, programs using stream sockets should place SENDTO in a loop that repeats the macro until all data has been sent.

Important: IPv6 support is not available with TCP/IP for z/VSE. Any reference to IPv6 addresses or address structures do not apply, if this program is used.

Format

Read syntax diagramSkip visual syntax diagramEZASMITYPE=SENDTO ,S= numberaddress*indaddr(reg) ,NBYTE= numberaddress*indaddr(reg) ,BUF= address*indaddr(reg) ,NAME= address*indaddr(reg) ,ERRNO= address*indaddr(reg) ,RETCODE= address*indaddr(reg) ,ERROR=address*indaddr(reg),TASK=address*indaddr(reg)

Parameters

S
Output parameter. A value, or the address of a halfword binary number specifying the socket descriptor of the socket sending the data.
NBYTE
Input parameter. A value, or the address of a fullword binary number specifying the number of bytes to transmit.
BUF
Input parameter. The address of the data being transmitted. The length of BUF must be at least as long as the value of NBYTE.
NAME
Input parameter. The address of the IPv4 or IPv6 target. Include the PRD1.MACLIB(EZBREHST) macro to get the assembler mappings for the socket address structure. The socket address structure mappings begin at the SOCKADDR label. The AF_INET socket address structure fields start at the SOCK_SIN label. The AF_INET6 socket address structure fields start at the SOCK_SIN6 label.
The IPv4 socket address structure contains the following fields:
FAMILY
A halfword binary field specifying the IPv4 addressing family. For TCP/IP the value is a decimal 2, indicating AF_INET.
PORT
A halfword binary field specifying the port number bound to the socket.
IPv4-ADDRESS
A fullword binary field specifying the 32-bit IPv4 Internet address of the socket.
RESERVED
Specifies eight bytes of binary zeros. This field is required, but is not used.
The IPv6 socket address structure contains the following fields:
NAMELEN
A 1-byte binary field that specifies the length of the IPv6 socket address structure. Any value specified by the use of this field is ignored, if processed as input. The field is set to 0, if processed as output.
FAMILY
A 1-byte binary field that specifies the IPv6 addressing family. For TCP/IP the value is a decimal 19, indicating AF_INET6.
PORT
A halfword binary field specifying the port number bound to the socket.
FLOW-INFO
A fullword binary field specifying the traffic class and flow label. This value of this field is undefined.
IPv6-ADDRESS
A 16-byte binary field that is set to the 128-bit IPv6 Internet address of the socket, in network byte order, of the client machine.
SCOPE-ID
A fullword binary field which identifies a set of interfaces as appropriate for the scope of the address carried in the IPv6-ADDRESS field. For a link scope IPv6-ADDRESS, SCOPE-ID contains the link index for the IPv6-ADDRESS. For all other address scopes, SCOPE-ID is undefined.
ERRNO
Output parameter. A fullword binary field. If RETCODE is negative, ERRNO contains a valid error number. Otherwise, ignore ERRNO.

See ERRNO Values for information about ERRNO return codes.

RETCODE
Output parameter. A fullword binary field that returns one of the following:
Value
Description
0 or >0
A successful call. The value is set to the number of bytes transmitted.
-1
Check ERRNO for an error code.
ERROR
Input parameter. The location in your program to receive control, if the application programming interface (API) processing module cannot be loaded.
TASK
Input parameter. The location of the task storage area in your program.