Metrologic Optimus S Programming Manual page 164

"c" programming guide
Table of Contents

Advertisement

158
"C" Programming Guide For Optimus S/R
send
sendto
Purpose
To send data to a connected socket.
Syntax
int send (SOCKET s, char *buf, int len, int flags);
s
buf
len
flags
Example
SOCKET s;
char buf[1024];
int len, tlen;
...................
len = strlen (buf);
tlen = send (s, buf, len, 0);
if (tlen < 0) {
printf ("send fails on socket: %d", s);
...................
}
Description
This routine writes outgoing data to a specified send buffer (buf) on a
connected socket.
The flags argument allows one of the following values:
MSG_OOB
MSG_DONTROUTE
The application can avoid this blocking behavior by using socket_cansend() to
make sure there is data available before calling send(). (?)
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
recv, sendto, socket_cansend
Purpose
To send data to a connected socket.
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
sends urgent data (out-of-bound data)
sends data using direct interface

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents