aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/udp__sock_8cpp-source.html
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
committerneodarz <neodarz@neodarz.net>2018-08-11 20:21:34 +0200
commit0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch)
tree2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/udp__sock_8cpp-source.html
downloadnevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz
nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip
Initial commit
Diffstat (limited to 'docs/doxygen/nel/udp__sock_8cpp-source.html')
-rw-r--r--docs/doxygen/nel/udp__sock_8cpp-source.html272
1 files changed, 272 insertions, 0 deletions
diff --git a/docs/doxygen/nel/udp__sock_8cpp-source.html b/docs/doxygen/nel/udp__sock_8cpp-source.html
new file mode 100644
index 00000000..834a197c
--- /dev/null
+++ b/docs/doxygen/nel/udp__sock_8cpp-source.html
@@ -0,0 +1,272 @@
+<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<HTML>
+<HEAD>
+ <TITLE>nevrax.org : docs</TITLE>
+ <LINK REL=stylesheet TYPE="text/css" HREF="http://www.nevrax.org/inc/css/nevrax.css">
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+</HEAD>
+<BODY MARGINHEIGHT="0" MARGINWIDTH="0">
+
+<!-- uplinks -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.org><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ <TD><IMG width=6 height=14 SRC="http://www.nevrax.org/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF=http://www.nevrax.com><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
+ </TR>
+</TABLE>
+
+<!-- banner Nevrax -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%>
+ <TR><TD BGCOLOR="#000000" BACKGROUND="http://www.nevrax.org/inc/img/black_banner.jpg"><A HREF="http://www.nevrax.org"><IMG SRC="http://www.nevrax.org/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
+</TABLE>
+
+<!-- main table -->
+<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 height=100%>
+ <TR>
+ <TD WIDTH=16><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
+ <TD WIDTH=140 BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+ <!------ Begin Box ------>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0 cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
+ <FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td colspan=2 bgcolor=#FFFFFF>
+ <TABLE cellspacing=0 cellpadding=1 border=0>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="Rubrique news"><img width=13 height=15 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-news.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/news/" TITLE="News">News</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Rubrique mail"><img width=15 height=11 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-mail.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Rubrique docs"><img width=14 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-docs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/docs/" TITLE="Documentation">Documentation</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="Rubrique cvs"><img width=13 height=17 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-cvs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/cvs/" TITLE="CVS Web">CVS</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Rubrique bugs"><img width=20 height=16 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-bugs.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
+ <tr><td ALIGN=middle><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="Rubrique license"><img width=18 height=12 hspace=5 border=0 src=http://www.nevrax.org/inc/img/picto-gpl.gif ALT=#></A></td><td><a class='linkbox' href="http://www.nevrax.org/GPL.php3" TITLE="License">License</a></td></tr>
+ </TABLE>
+ </TD></TR></TABLE></TD></TR></TABLE>
+ <!------ End Box ------>
+
+ </TD>
+ <TD WIDTH=15><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
+ <TD ALIGN=left valign=top><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">
+
+<!-- title -->
+<TABLE background="http://www.nevrax.org/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td>
+<A HREF="http://www.nevrax.org/docs/"><img src="http://www.nevrax.org/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
+</td><td><IMG SRC="http://www.nevrax.org/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
+</td></tr></table>
+&nbsp;
+
+<!-- block -->
+<TABLE bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0 BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="http://www.nevrax.org/inc/img/reddots.gif"></TD>
+ <TD><B>Documentation</B></TD>
+ <TD ALIGN=RIGHT>&nbsp;</td>
+</tr></table>
+<!-- Generated by Doxygen 1.2.14 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:http://www.nevrax.org/cgi-bin/nel-search.cgi" href="http://www.nevrax.org/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
+<hr><h1>udp_sock.cpp</h1><a href="udp__sock_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001
+00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
+00008 <font class="comment"> *</font>
+00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
+00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
+00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
+00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
+00013 <font class="comment"> * any later version.</font>
+00014 <font class="comment"></font>
+00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
+00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
+00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
+00018 <font class="comment"> * General Public License for more details.</font>
+00019 <font class="comment"></font>
+00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
+00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
+00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
+00023 <font class="comment"> * MA 02111-1307, USA.</font>
+00024 <font class="comment"> */</font>
+00025
+00026 <font class="preprocessor">#include "<a class="code" href="stdnet_8h.html">stdnet.h</a>"</font>
+00027
+00028 <font class="preprocessor">#include "<a class="code" href="udp__sock_8h.html">nel/net/udp_sock.h</a>"</font>
+00029
+00030 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00031 <font class="preprocessor"></font><font class="preprocessor">#include &lt;winsock2.h&gt;</font>
+00032 <font class="preprocessor">#define socklen_t int</font>
+00033 <font class="preprocessor"></font><font class="preprocessor">#define ERROR_NUM WSAGetLastError()</font>
+00034 <font class="preprocessor"></font>
+00035 <font class="preprocessor">#elif defined NL_OS_UNIX</font>
+00036 <font class="preprocessor"></font><font class="preprocessor">#include &lt;<a class="code" href="unistd_8h.html">unistd.h</a>&gt;</font>
+00037 <font class="preprocessor">#include &lt;sys/types.h&gt;</font>
+00038 <font class="preprocessor">#include &lt;sys/time.h&gt;</font>
+00039 <font class="preprocessor">#include &lt;sys/socket.h&gt;</font>
+00040 <font class="preprocessor">#include &lt;netinet/in.h&gt;</font>
+00041 <font class="preprocessor">#include &lt;netinet/tcp.h&gt;</font>
+00042 <font class="preprocessor">#include &lt;arpa/inet.h&gt;</font>
+00043 <font class="preprocessor">#include &lt;netdb.h&gt;</font>
+00044 <font class="preprocessor">#include &lt;errno.h&gt;</font>
+00045 <font class="comment">//#include &lt;fcntl.h&gt;</font>
+00046 <font class="preprocessor">#define SOCKET_ERROR -1</font>
+00047 <font class="preprocessor"></font><font class="preprocessor">#define INVALID_SOCKET -1</font>
+00048 <font class="preprocessor"></font><font class="preprocessor">#define ERROR_NUM errno</font>
+00049 <font class="preprocessor"></font><font class="preprocessor">#define ERROR_MSG strerror(errno)</font>
+00050 <font class="preprocessor"></font><font class="keyword">typedef</font> <font class="keywordtype">int</font> SOCKET;
+00051
+00052 <font class="preprocessor">#endif</font>
+00053 <font class="preprocessor"></font>
+00054 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
+00055
+00056 <font class="keyword">namespace </font>NLNET {
+00057
+00058
+00059 <font class="comment">/*</font>
+00060 <font class="comment"> * Constructor</font>
+00061 <font class="comment"> */</font>
+<a name="l00062"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z349_0">00062</a> CUdpSock::CUdpSock( <font class="keywordtype">bool</font> logging ) :
+00063 CSock( logging ),
+00064 _Bound( false )
+00065 {
+00066 <font class="comment">// Socket creation</font>
+00067 <a class="code" href="classNLNET_1_1CSock.html#b2">createSocket</a>( SOCK_DGRAM, IPPROTO_UDP );
+00068 }
+00069
+00070
+<a name="l00074"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z349_1">00074</a> <font class="keywordtype">void</font> CUdpSock::bind( <a class="code" href="types__nl_8h.html#a7">uint16</a> port )
+00075 {
+00076 CInetAddress addr; <font class="comment">// any IP address</font>
+00077 addr.setPort( port );
+00078 <a class="code" href="classNLNET_1_1CUdpSock.html#z349_1">bind</a>( addr );
+00079 <a class="code" href="classNLNET_1_1CSock.html#b3">setLocalAddress</a>(); <font class="comment">// will not set the address if the host is multihomed, use bind(CInetAddress) instead</font>
+00080 }
+00081
+00082
+00083 <font class="comment">/*</font>
+00084 <font class="comment"> * Same as bind(uint16) but binds on a specified address/port (useful when the host has several addresses)</font>
+00085 <font class="comment"> */</font>
+<a name="l00086"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z349_2">00086</a> <font class="keywordtype">void</font> CUdpSock::bind( <font class="keyword">const</font> CInetAddress&amp; addr )
+00087 {
+00088 <font class="preprocessor">#ifndef NL_OS_WINDOWS</font>
+00089 <font class="preprocessor"></font> <font class="comment">// Set Reuse Address On (does not work on Win98 and is useless on Win2000)</font>
+00090 <font class="keywordtype">int</font> value = <font class="keyword">true</font>;
+00091 <font class="keywordflow">if</font> ( setsockopt( <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, SOL_SOCKET, SO_REUSEADDR, &amp;value, <font class="keyword">sizeof</font>(value) ) == SOCKET_ERROR )
+00092 {
+00093 <font class="keywordflow">throw</font> ESocket( <font class="stringliteral">"ReuseAddr failed"</font> );
+00094 }
+00095 <font class="preprocessor">#endif</font>
+00096 <font class="preprocessor"></font>
+00097 <a class="code" href="classNLNET_1_1CSock.html#n1">_LocalAddr</a> = addr;
+00098
+00099 <font class="comment">// Bind the socket</font>
+00100 <font class="keywordflow">if</font> ( ::bind( <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, (sockaddr*)(<a class="code" href="classNLNET_1_1CSock.html#n1">_LocalAddr</a>.sockAddr()), <font class="keyword">sizeof</font>(sockaddr) ) == SOCKET_ERROR )
+00101 {
+00102 <font class="keywordflow">throw</font> ESocket( <font class="stringliteral">"Bind failed"</font> );
+00103 }
+00104 <a class="code" href="classNLNET_1_1CUdpSock.html#o0">_Bound</a> = <font class="keyword">true</font>;
+00105 <font class="keywordflow">if</font> ( _Logging )
+00106 {
+00107 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"LNETL0: Socket %d bound at %s"</font>, <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, <a class="code" href="classNLNET_1_1CSock.html#n1">_LocalAddr</a>.asString().c_str() );
+00108 }
+00109 }
+00110
+00111
+00112 <font class="comment">/*</font>
+00113 <font class="comment"> * Sends a message</font>
+00114 <font class="comment"> */</font>
+<a name="l00115"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z351_0">00115</a> <font class="keywordtype">void</font> CUdpSock::sendTo( <font class="keyword">const</font> <a class="code" href="types__nl_8h.html#a5">uint8</a> *buffer, <a class="code" href="types__nl_8h.html#a13">uint</a> <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, <font class="keyword">const</font> CInetAddress&amp; addr )
+00116 {
+00117
+00118 <font class="comment">// Send</font>
+00119 <font class="keywordflow">if</font> ( ::sendto( <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, (<font class="keyword">const</font> <font class="keywordtype">char</font>*)buffer, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, 0, (sockaddr*)(addr.sockAddr()), <font class="keyword">sizeof</font>(sockaddr) ) != (sint32)<a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> )
+00120 {
+00121 <font class="keywordflow">throw</font> ESocket( <font class="stringliteral">"Unable to send datagram"</font> );
+00122 }
+00123 <a class="code" href="classNLNET_1_1CSock.html#n7">_BytesSent</a> += <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>;
+00124
+00125 <font class="keywordflow">if</font> ( _Logging )
+00126 {
+00127 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"LNETL0: Socket %d sent %d bytes to %s"</font>, <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, addr.asString().c_str() );
+00128 }
+00129
+00130 <font class="comment">// If socket is unbound, retrieve local address</font>
+00131 <font class="keywordflow">if</font> ( ! <a class="code" href="classNLNET_1_1CUdpSock.html#o0">_Bound</a> )
+00132 {
+00133 <a class="code" href="classNLNET_1_1CSock.html#b3">setLocalAddress</a>();
+00134 <a class="code" href="classNLNET_1_1CUdpSock.html#o0">_Bound</a> = <font class="keyword">true</font>;
+00135 }
+00136
+00137 <font class="preprocessor">#ifdef NL_OS_WINDOWS</font>
+00138 <font class="preprocessor"></font> <font class="comment">// temporary by ace to know size of SO_MAX_MSG_SIZE</font>
+00139 <font class="keyword">static</font> <font class="keywordtype">bool</font> first = <font class="keyword">true</font>;
+00140 <font class="keywordflow">if</font> (first)
+00141 {
+00142 <a class="code" href="types__nl_8h.html#a13">uint</a> MMS, SB;
+00143 <font class="keywordtype">int</font> <a class="code" href="lexlang_8cpp.html#a56">size</a> = <font class="keyword">sizeof</font> (MMS);
+00144 getsockopt (<a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, SOL_SOCKET, SO_SNDBUF, (<font class="keywordtype">char</font> *)&amp;SB, &amp;<a class="code" href="lexlang_8cpp.html#a56">size</a>);
+00145 getsockopt (<a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, SOL_SOCKET, SO_MAX_MSG_SIZE, (<font class="keywordtype">char</font> *)&amp;MMS, &amp;<a class="code" href="lexlang_8cpp.html#a56">size</a>);
+00146 <a class="code" href="debug_8h.html#a1">nlinfo</a> (<font class="stringliteral">"the udp SO_MAX_MSG_SIZE=%u, SO_SNDBUF=%u"</font>, MMS, SB);
+00147 first = <font class="keyword">false</font>;
+00148 }
+00149 <font class="preprocessor">#endif</font>
+00150 <font class="preprocessor"></font>}
+00151
+00152
+00153 <font class="comment">/*</font>
+00154 <font class="comment"> * Receives data from the peer. (blocking function)</font>
+00155 <font class="comment"> */</font>
+<a name="l00156"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z350_0">00156</a> <font class="keywordtype">void</font> CUdpSock::receive( <a class="code" href="types__nl_8h.html#a5">uint8</a> *buffer, <a class="code" href="types__nl_8h.html#a9">uint32</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> )
+00157 {
+00158 <a class="code" href="debug_8h.html#a6">nlassert</a>( <a class="code" href="classNLNET_1_1CSock.html#n5">_Connected</a> &amp;&amp; (buffer!=NULL) );
+00159
+00160 <font class="comment">// Receive incoming message</font>
+00161 <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> = ::recv( <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, (<font class="keywordtype">char</font>*)buffer, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> , 0 );
+00162
+00163 <font class="comment">// Check for errors (after setting the address)</font>
+00164 <font class="keywordflow">if</font> ( <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> == SOCKET_ERROR )
+00165 {
+00166 <font class="keywordflow">throw</font> ESocket( <font class="stringliteral">"Cannot receive data"</font> );
+00167 }
+00168
+00169 <a class="code" href="classNLNET_1_1CSock.html#n6">_BytesReceived</a> += <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>;
+00170 <font class="keywordflow">if</font> ( _Logging )
+00171 {
+00172 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"LNETL0: Socket %d received %d bytes from peer %s"</font>, <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, <a class="code" href="classNLNET_1_1CSock.html#n2">_RemoteAddr</a>.asString().c_str() );
+00173 }
+00174 }
+00175
+00176
+00177 <font class="comment">/*</font>
+00178 <font class="comment"> * Receives data and say who the sender is. (blocking function)</font>
+00179 <font class="comment"> */</font>
+<a name="l00180"></a><a class="code" href="classNLNET_1_1CUdpSock.html#z350_1">00180</a> <font class="keywordtype">void</font> CUdpSock::receivedFrom( <a class="code" href="types__nl_8h.html#a5">uint8</a> *buffer, <a class="code" href="types__nl_8h.html#a13">uint</a>&amp; <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, CInetAddress&amp; addr )
+00181 {
+00182 <font class="comment">// Receive incoming message</font>
+00183 sockaddr_in saddr;
+00184 socklen_t saddrlen = <font class="keyword">sizeof</font>(saddr);
+00185
+00186 <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> = ::recvfrom( <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, (<font class="keywordtype">char</font>*)buffer, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> , 0, (sockaddr*)&amp;saddr, &amp;saddrlen );
+00187
+00188 <font class="comment">// If an error occurs, the saddr is not valid</font>
+00189 <font class="comment">// When the remote socket is closed, get sender's address to know who is quitting</font>
+00190 addr.setSockAddr( &amp;saddr );
+00191
+00192 <font class="comment">// Check for errors (after setting the address)</font>
+00193 <font class="keywordflow">if</font> ( <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a> == SOCKET_ERROR )
+00194 {
+00195 <font class="keywordflow">throw</font> ESocket( <font class="stringliteral">"Cannot receive data"</font> );
+00196 }
+00197
+00198 <a class="code" href="classNLNET_1_1CSock.html#n6">_BytesReceived</a> += <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>;
+00199 <font class="keywordflow">if</font> ( _Logging )
+00200 {
+00201 <a class="code" href="debug_8h.html#a0">nldebug</a>( <font class="stringliteral">"LNETL0: Socket %d received %d bytes from %s"</font>, <a class="code" href="classNLNET_1_1CSock.html#n0">_Sock</a>, <a class="code" href="driver__opengl__extension__def_8h.html#a230">len</a>, addr.asString().c_str() );
+00202 }
+00203 }
+00204
+00205
+00206 } <font class="comment">// NLNET</font>
+</pre></div>
+
+<!-- footer -->
+<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
+</TD>
+<TD WIDTH=15><IMG SRC=http://www.nevrax.org/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
+</TR>
+</TABLE>
+</BODY>
+</HTML>