Chapter Contents

Previous

Next
send

send



Sends a Message to a Connected Socket

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
PORTABILITY
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <sys/socket.h>

int send(int s, const void *buf, int len, int flags);


DESCRIPTION

send transmits a message to socket descriptor s . The socket must be connected or associated with a foreign peer via the connect function. buf points to the buffer that contains the message. len is the number of bytes to be sent.

flags consists of the following:

MSG_OOB
requests that message buffers be sent as out-of-band data.

MSG_DONTROUTE
bypasses routing; uses the network portion of the destination address to select a network interface.


RETURN VALUE

If send succeeds, it returns the number of characters sent. If there is an error, it returns a -1 .


PORTABILITY

send is portable to other environments, including most UNIX systems, that implement BSD sockets.


RELATED FUNCTIONS

recv , recvfrom , recvmsg , sendmsg , sendto , write


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.