Receiving Data - HP Rp3440-4 - 9000 - 0 MB RAM Programmer's Manual

Bsd sockets interface programmer’s guide
Hide thumbs Also See for Rp3440-4 - 9000 - 0 MB RAM:
Table of Contents

Advertisement

Using Internet Stream Sockets
Sending and Receiving Data
Parameter
msg
pointer to data buffer
len
size of data buffer
flags
settings for optional flags
Function result: number of bytes actually sent, –1 if failure occurs.
Example:
count = send (s, buf, 10, 0);
send blocks until the specified number of bytes have been queued to be
sent, unless you are using nonblocking I/O.
When to Send Data
The server or client process should send data after the connection is
established. Refer to the send(2) man page for more information on
send.

Receiving Data

recv and its parameters are described in the following table.
Include files:
#include <sys/types.h>
#include <sys/socket.h>
System call:
count = recv(s,buf,len,flags)
int s;
char *buf;
int len, flags;
44
Description of
Contents
INPUT Value
pointer to data to be sent
size of msg
0 or MSG_OOB
Chapter 2

Advertisement

Table of Contents
loading

Table of Contents