Poster of Linux kernelThe best gift for a Linux geek
NETREAD

NETREAD

Section: Common Library Functions (3) Updated: $Date: 2005/03/29 09:27:19 $
Local index Up
 

NAME

netread - receive a message from a socket  

SYNOPSIS

#include "net.h"

int netread (int s, char *buf, int nbytes);

ssize_t netread_timeout (int s, void *buf, size_t nbytes, int timeout);  

DESCRIPTION

netread receives a message from a socket. It overcomes the message fragmentation problem and always waits for all requested bytes to arrive or a timeout/error occurs.  

RETURN VALUE

This routine returns the number of bytes if the operation was successful, 0 if the connection was closed by the remote end or -1 if the operation failed. In the latter case, serrno is set appropriately.  

ERRORS

EINTR
The function was interrupted by a signal.
EBADF
s is not a valid descriptor.
EAGAIN
The socket is non-blocking and there is no message available.
EFAULT
buf is not a valid pointer.
EINVAL
nbytes is negative or zero.
ENOTSOCK
s is not a socket.
SECONNDROP
Connection closed by remote end.
SETIMEDOUT
Timed out.
 

SEE ALSO

recv(2), neterror(3)  

AUTHOR

LCG Grid Deployment Team


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO
AUTHOR

This document was created by man2html, using the manual pages.
Time: 21:51:18 GMT, April 16, 2011