sendto()

Sends data on a socket. The sendto() call may be used by both the server and client processes.

Syntax

count = sendto(socket, buffer, len, flags, addr, addrlen)

int

count,

socket, len, addrlen;

char

*buffer;

long

flags;

 

struct sockaddr_in *addr;

Parameters

count

Returns the number of bytes actually sent. Returns -1if the

 

call encounters an error.

socket

Socket descriptor of a local socket that is sending the data.

buffer

Byte pointer to a buffer which contains the data to be sent.

len

Number of bytes that need to be sent from the data buffer. The

 

size of data that can be sent is limited to 32767 bytes. However,

 

the HP 1000 cannot receive UDP datagrams larger than 9216

 

bytes.

flags

Currently there are no supported options.

addr

Pointer to a structure containing the address of the remote

 

socket to which the data will be sent. The socket address should

 

be of sockaddr_in type.

addrlen

Length, in bytes, of the address structure specified by addr (for

 

example, length of structure sockaddr_in, which is 16 bytes).

 

Addrlen should be at least 16 bytes.

416 Berkeley Software Distribution Interprocess Communication