<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>bnet_recv</TITLE> <META NAME="description" CONTENT="bnet_recv"> <META NAME="keywords" CONTENT="developers"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="developers.css"> <LINK REL="next" HREF="bnet_sig.html"> <LINK REL="previous" HREF="Additional_Error_informatio.html"> <LINK REL="up" HREF="TCP_IP_Network_Protocol.html"> <LINK REL="next" HREF="bnet_sig.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1727" HREF="bnet_sig.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1721" HREF="TCP_IP_Network_Protocol.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1715" HREF="Additional_Error_informatio.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1723" HREF="Contents.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1725" HREF="GNU_Free_Documentation_Lice.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1728" HREF="bnet_sig.html">bnet_sig</A> <B> Up:</B> <A NAME="tex2html1722" HREF="TCP_IP_Network_Protocol.html">TCP/IP Network Protocol</A> <B> Previous:</B> <A NAME="tex2html1716" HREF="Additional_Error_informatio.html">Additional Error information</A> <B> <A NAME="tex2html1724" HREF="Contents.html">Contents</A></B> <B> <A NAME="tex2html1726" HREF="GNU_Free_Documentation_Lice.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION001870000000000000000"></A> <A NAME="6256"></A> <BR> bnet_recv </H1> <P> To read a packet, one uses the subroutine: <P> int bnet_recv(BSOCK *sock) This routine is similar to a read() except that it handles the low level details. bnet_read() first reads packet length that follows as four bytes in network byte order. The data is read into sock-msg and is sock-msglen bytes. If the sock-msg is not large enough, bnet_recv() realloc() the buffer. It will return an error (-2) if maxbytes is less than the record size sent. It returns: <P> <PRE> * Returns number of bytes read * Returns 0 on end of file * Returns -1 on hard end of file (i.e. network connection close) * Returns -2 on error </PRE> <P> It should be noted that bnet_recv() is a blocking read. <P> <BR><HR> <ADDRESS> 2010-06-14 </ADDRESS> </BODY> </HTML>