Metrologic Optimus S Programming Manual page 165

"c" programming guide
Table of Contents

Advertisement

Syntax
int sendto (SOCKET s, char *buf, int len, int flags, struct sockaddr *to, int
tolen);
s
buf
len
flags
to
tolen
(?)
Example
Description
This routine writes outgoing data to a specified send buffer (buf) on a socket.
The address of the targe is given by to with tolen specifying its size. The length
of the message is given by len. It is typically used on a connectionless socket.
The application can avoid this blocking behavior by using socket_cansend() to
make sure there is data available before calling sendto(). (?)
The whole data may not be sent at one time. Check the return value in case the
send buffer overflows. (?)
Return
If successful, it returns a non-negative integer (>=0) indicating the number of
bytes sent.
On error, it returns -1.
The global variable errno is set to indicate the error condition encountered.
See Also
recvfrom, sendto, socket_cansend
setsockopt
Purpose
To set options on a socket.
Syntax
int setsockopt (SOCKET s, int level, int optname, char *optval, int optlen);
s
level
optname
optval
optlen
Example
(?)
Description
This routine sets the current value for a socket option associated with a socket
of any type, in any state.
Chapter 3 Terminal Specific Function Library
Descriptor identifying a connected socket
Pointer to the buffer in which data is to be sent
Maximum number of bytes to be sent
MSG_OOB: process out-of-band data
MSG_DONTROUTE: bypass routing, use direct interface
Pointer to a sockaddr structure containing the address of the
target socket
Length of address indicated by to
Descriptor identifying a socket.
Level at which the option resides:
SOL_SOCKET, IPPROTO_TCP, or IPPROTO_IP
Socket option for which the value is to be set.
Pointer to the buffer in which the value for the requested
option is specified.
Length of the buffer indicated by optval
159

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents