Sending And Receiving Messages; Sending Messages - 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

Sending and Receiving Messages

The sendto and recvfrom (or sendmsg and recvmsg) system calls are
usually used to transmit and receive messages with datagram sockets.

Sending Messages

Use sendto or sendmsg to send messages. sendmsg is similar to
sendto, except sendmsg allows the send data to be gathered from
several buffers. sendto and its parameters are described in the
following table.
Include files:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
System call:
count = sendto(s, msg, len, flags, to, tolen)
int s;
char *msg;
int len, flags;
struct sockaddr_un *to;
int tolen;
Parameter
s
socket descriptor of local
socket
msg
pointer to data buffer
len
size of data buffer
flags
settings for optional
flags
to
address of recipient
socket
tolen
size of to
Chapter 7
Using UNIX Domain Datagram Sockets
Description of
Contents
Sending and Receiving Messages
INPUT Value
socket descriptor of socket
that is sending the
message
pointer to data to be sent
size of msg
0 (no options are currently
supported)
pointer to the socket
address that message
should be sent to
length of address
structure that to points to
155

Advertisement

Table of Contents
loading

Table of Contents