diff options
author | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2018-08-11 20:21:34 +0200 |
commit | 0ea5fc66924303d1bf73ba283a383e2aadee02f2 (patch) | |
tree | 2568e71a7ccc44ec23b8bb3f0ff97fb6bf2ed709 /docs/doxygen/nel/a02987.html | |
download | nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.tar.xz nevrax-website-self-hostable-0ea5fc66924303d1bf73ba283a383e2aadee02f2.zip |
Initial commit
Diffstat (limited to 'docs/doxygen/nel/a02987.html')
-rw-r--r-- | docs/doxygen/nel/a02987.html | 1564 |
1 files changed, 1564 insertions, 0 deletions
diff --git a/docs/doxygen/nel/a02987.html b/docs/doxygen/nel/a02987.html new file mode 100644 index 00000000..a557d799 --- /dev/null +++ b/docs/doxygen/nel/a02987.html @@ -0,0 +1,1564 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> +<title>NeL: NLNET::CNetManager class Reference</title> +<link href="doxygen.css" rel="stylesheet" type="text/css"> +</head><body> +<!-- Generated by Doxygen 1.3.6 --> +<div class="qindex"> <form class="search" action="search.php" method="get"> +<a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a> | <span class="search"><u>S</u>earch for <input class="search" type="text" name="query" value="" size="20" accesskey="s"/></span></form></div> +<h1>NLNET::CNetManager Class Reference</h1><code>#include <<a class="el" href="a06099.html">net_manager.h</a>></code> +<p> +<hr><a name="_details"></a><h2>Detailed Description</h2> +Layer 4<p> +In case of <a class="el" href="a02987.html#NLNET_1_1CNetManagere3">addGroup()</a>, messages are *not* associate with id, so the message type is always sent with string.<p> +<dl compact><dt><b>Author:</b></dt><dd>Vianney Lecroart <p> +Nevrax France </dd></dl> +<dl compact><dt><b>Date:</b></dt><dd>2001 </dd></dl> + +<p> + +<p> +Definition at line <a class="el" href="a06099.html#l00099">99</a> of file <a class="el" href="a06099.html">net_manager.h</a>.<table border=0 cellpadding=0 cellspacing=0> +<tr><td></td></tr> +<tr><td colspan=2><br><h2>Static Public Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere0">addCallbackArray</a> (const std::string &serviceName, const <a class="el" href="a03900.html">TCallbackItem</a> *callbackarray, <a class="el" href="a03449.html#NLMISC_1_1CStringIdArrayw0">NLMISC::CStringIdArray::TStringId</a> arraysize)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Adds a callback array to a specific service connection. You can add callback only *after* adding the server, the client or the group. <a href="#NLNET_1_1CNetManagere0"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere1">addClient</a> (const std::string &serviceName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a connection to a service using the naming service and the serviceName. <a href="#NLNET_1_1CNetManagere1"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere2">addClient</a> (const std::string &serviceName, const std::string &<a class="el" href="a04223.html#a657">addr</a>, bool autoRetry=true)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a connection to a specific IP and associate it this a "fake" serviceName (to enable you to send data for example). <a href="#NLNET_1_1CNetManagere2"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere3">addGroup</a> (const std::string &groupName, const std::string &serviceName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates connections to a group of service. <a href="#NLNET_1_1CNetManagere3"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere4">addServer</a> (const std::string &serviceName, <a class="el" href="a04558.html#a9">uint16</a> servicePort, <a class="el" href="a05379.html#a93">NLNET::TServiceId</a> &sid, bool external=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere5">addServer</a> (const std::string &serviceName, <a class="el" href="a04558.html#a9">uint16</a> servicePort=0, bool external=false)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere6">createConnection</a> (<a class="el" href="a02257.html">CBaseStruct</a> &Base, const <a class="el" href="a02665.html">CInetAddress</a> &Addr, const std::string &name)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere7">getBytesReceived</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere8">getBytesSent</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02306.html">CCallbackNetBase</a> * </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere9">getNetBase</a> (const std::string &serviceName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the connection if you want to do specific calls. <a href="#NLNET_1_1CNetManagere9"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere10">getReceiveQueueSize</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a04558.html#a13">uint64</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere11">getSendQueueSize</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a03449.html">NLMISC::CStringIdArray</a> & </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere12">getSIDA</a> (const std::string &serviceName)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Use this function to get the String ID Array needed when you want to create a message. <a href="#NLNET_1_1CNetManagere12"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere13">init</a> (const <a class="el" href="a02665.html">CInetAddress</a> *<a class="el" href="a04223.html#a657">addr</a>, <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> rec)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere14">release</a> ()</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere15">send</a> (const std::string &serviceName, const <a class="el" href="a02918.html">CMessage</a> &<a class="el" href="a04223.html#a589">buffer</a>, <a class="el" href="a02303.html">TSockId</a> hostid=<a class="el" href="a05379.html#a75">InvalidSockId</a>)</td></tr> + +<tr><td class="mdescLeft"> </td><td class="mdescRight">Sends a message to a specific serviceName. <a href="#NLNET_1_1CNetManagere15"></a><br><br></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere16">setConnectionCallback</a> (const std::string &serviceName, <a class="el" href="a05379.html#a95">TNetManagerCallback</a> cb, void *arg)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere17">setDisconnectionCallback</a> (const std::string &serviceName, <a class="el" href="a05379.html#a95">TNetManagerCallback</a> cb, void *arg)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere18">setUpdateTimeout</a> (<a class="el" href="a04558.html#a11">uint32</a> timeout)</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagere19">update</a> (<a class="el" href="a05378.html#a242">NLMISC::TTime</a> timeout=0)</td></tr> + +<tr><td colspan=2><br><h2>Private Types</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef TBaseMap::iterator </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top>typedef std::map< std::string,<br> + <a class="el" href="a02257.html">CBaseStruct</a> > </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagery1">TBaseMap</a></td></tr> + +<tr><td colspan=2><br><h2>Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagerd0">CNetManager</a> ()</td></tr> + +<tr><td colspan=2><br><h2>Static Private Member Functions</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (const std::string &serviceName)</td></tr> + +<tr><td colspan=2><br><h2>Static Private Attributes</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02987.html#NLNET_1_1CNetManagery1">TBaseMap</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a></td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a05378.html#a242">NLMISC::TTime</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a> = 0</td></tr> + +<tr><td class="memItemLeft" nowrap align=right valign=top><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagerv2">_RecordingState</a></td></tr> + +<tr><td colspan=2><br><h2>Friends</h2></td></tr> +<tr><td class="memItemLeft" nowrap align=right valign=top>void </td><td class="memItemRight" valign=bottom><a class="el" href="a02987.html#NLNET_1_1CNetManagern0">RegistrationBroadcast</a> (const std::string &name, <a class="el" href="a05379.html#a93">TServiceId</a> sid, const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > &<a class="el" href="a04223.html#a657">addr</a>)</td></tr> + +</table> +<hr><h2>Member Typedef Documentation</h2> +<a class="anchor" name="NLNET_1_1CNetManagery0" doxytag="NLNET::CNetManager::ItBaseMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef TBaseMap::iterator <a class="el" href="a02987.html#NLNET_1_1CNetManagery0">NLNET::CNetManager::ItBaseMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06099.html#l00171">171</a> of file <a class="el" href="a06099.html">net_manager.h</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00346">addCallbackArray()</a>, <a class="el" href="a06098.html#l00256">addClient()</a>, <a class="el" href="a06098.html#l00307">addGroup()</a>, <a class="el" href="a06098.html#l00207">addServer()</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06098.html#l00510">getBytesReceived()</a>, <a class="el" href="a06098.html#l00497">getBytesSent()</a>, <a class="el" href="a06098.html#l00466">getNetBase()</a>, <a class="el" href="a06098.html#l00536">getReceiveQueueSize()</a>, <a class="el" href="a06098.html#l00523">getSendQueueSize()</a>, <a class="el" href="a06098.html#l00335">getSIDA()</a>, <a class="el" href="a06098.html#l00131">NLNET::RegistrationBroadcast()</a>, <a class="el" href="a06098.html#l00185">release()</a>, <a class="el" href="a06098.html#l00455">send()</a>, <a class="el" href="a06098.html#l00472">setConnectionCallback()</a>, <a class="el" href="a06098.html#l00480">setDisconnectionCallback()</a>, and <a class="el" href="a06098.html#l00357">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagery1" doxytag="NLNET::CNetManager::TBaseMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> typedef std::map<std::string, <a class="el" href="a02257.html">CBaseStruct</a>> <a class="el" href="a02987.html#NLNET_1_1CNetManagery1">NLNET::CNetManager::TBaseMap</a><code> [private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06099.html#l00170">170</a> of file <a class="el" href="a06099.html">net_manager.h</a>. </td> + </tr> +</table> +<hr><h2>Constructor & Destructor Documentation</h2> +<a class="anchor" name="NLNET_1_1CNetManagerd0" doxytag="NLNET::CNetManager::CNetManager" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> NLNET::CNetManager::CNetManager </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [inline, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06099.html#l00188">188</a> of file <a class="el" href="a06099.html">net_manager.h</a>. +<p> +<div class="fragment"><pre>00188 { } +</pre></div> </td> + </tr> +</table> +<hr><h2>Member Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CNetManagere0" doxytag="NLNET::CNetManager::addCallbackArray" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addCallbackArray </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a03900.html">TCallbackItem</a> * </td> + <td class="mdname" nowrap> <em>callbackarray</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a03449.html#NLMISC_1_1CStringIdArrayw0">NLMISC::CStringIdArray::TStringId</a> </td> + <td class="mdname" nowrap> <em>arraysize</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Adds a callback array to a specific service connection. You can add callback only *after* adding the server, the client or the group. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00346">346</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a06468.html#l00054">NLMISC::CStringIdArray::TStringId</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00347 { +00348 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: addingCallabckArray() for service '%s'"</span>, serviceName.c_str ()); +00349 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00350 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00351 { +00352 <span class="comment">// if ((*itbm).second.NetBase[i]->connected())</span> +00353 (*itbm).second.NetBase[i]->addCallbackArray (callbackarray, arraysize); +00354 } +00355 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere1" doxytag="NLNET::CNetManager::addClient" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addClient </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>serviceName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates a connection to a service using the naming service and the serviceName. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00280">280</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00058">_RecordingState</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a05524.html#l00272">NLNET::CCallbackClient::getSockId()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, and <a class="el" href="a06098.html#l00074">NLNET::nmNewDisconnection()</a>. +<p> +<div class="fragment"><pre>00281 { +00282 <a class="code" href="a04199.html#a6">nlassert</a> (CNamingClient::connected ()); +00283 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: Adding client '%s' in CNetManager"</span>, serviceName.c_str ()); +00284 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00285 +00286 <span class="comment">// check if it's a new client</span> +00287 <a class="code" href="a04199.html#a6">nlassert</a> ((*itbm).second.NetBase.empty()); +00288 +00289 CCallbackClient *cc = <span class="keyword">new</span> CCallbackClient( _RecordingState, serviceName+string(<span class="stringliteral">".nmr"</span>) ); <span class="comment">// ? - would not work if several clients with the same name</span> +00290 (*itbm).second.NetBase.push_back (cc); +00291 +00292 (*itbm).second.Type = CBaseStruct::Client; +00293 +00294 cc->CCallbackNetBase::setDisconnectionCallback (nmNewDisconnection, (<span class="keywordtype">void</span>*) &((*itbm).second)); +00295 +00296 <span class="comment">// find the service in the naming_service and connect if exists</span> +00297 <span class="keywordflow">if</span> (CNamingClient::lookupAndConnect (serviceName, *cc)) +00298 { +00299 <span class="comment">// call the user that we are connected</span> +00300 <span class="keywordflow">if</span> ((*itbm).second.ConnectionCallback != NULL) +00301 (*itbm).second.ConnectionCallback (serviceName, cc->getSockId(), (*itbm).second.ConnectionCbArg); +00302 } +00303 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere2" doxytag="NLNET::CNetManager::addClient" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addClient </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::string & </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>autoRetry</em> = true</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates a connection to a specific IP and associate it this a "fake" serviceName (to enable you to send data for example). +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00256">256</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06098.html#l00097">createConnection()</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +<div class="fragment"><pre>00257 { +00258 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: Adding client '%s' with addr '%s' in CNetManager"</span>, serviceName.c_str (), <a class="code" href="a04223.html#a657">addr</a>.c_str()); +00259 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00260 +00261 <span class="comment">// it's a new client, add the connection</span> +00262 (*itbm).second.Type = CBaseStruct::ClientWithAddr; +00263 (*itbm).second.AutoRetry = autoRetry; +00264 +00265 <span class="keywordflow">if</span> ((*itbm).second.ServiceNames.empty()) +00266 { +00267 (*itbm).second.ServiceNames.push_back(addr); +00268 } +00269 <span class="keywordflow">else</span> +00270 { +00271 (*itbm).second.ServiceNames[0] = <a class="code" href="a04223.html#a657">addr</a>; +00272 } +00273 +00274 <a class="code" href="a04199.html#a6">nlassert</a> ((*itbm).second.NetBase.size() < 2); +00275 +00276 <a class="code" href="a02987.html#NLNET_1_1CNetManagere6">createConnection</a> ((*itbm).second, addr, serviceName); +00277 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere3" doxytag="NLNET::CNetManager::addGroup" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addGroup </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>groupName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates connections to a group of service. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00307">307</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00097">createConnection()</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +<div class="fragment"><pre>00308 { +00309 <a class="code" href="a04199.html#a6">nlassert</a> (CNamingClient::connected ()); +00310 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: Adding '%s' to group '%s' in CNetManager"</span>, serviceName.c_str (), groupName.c_str()); +00311 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (groupName); +00312 +00313 (*itbm).second.Type = CBaseStruct::Group; +00314 +00315 <span class="comment">// check if you don't already add this service in this group</span> +00316 vector<string>::iterator it = std::find ((*itbm).second.ServiceNames.begin(), (*itbm).second.ServiceNames.end(), serviceName); +00317 <a class="code" href="a04199.html#a6">nlassert</a> (it == (*itbm).second.ServiceNames.end()); +00318 +00319 (*itbm).second.ServiceNames.push_back(serviceName); +00320 +00321 +00322 <span class="comment">// find the service in the naming_service and connect if exists</span> +00323 vector<CInetAddress> addrs; +00324 CNamingClient::lookupAll (serviceName, addrs); +00325 +00326 <span class="comment">// connect to all these services</span> +00327 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < addrs.size (); i++) +00328 { +00329 <a class="code" href="a02987.html#NLNET_1_1CNetManagere6">createConnection</a> ((*itbm).second, addrs[i], serviceName); +00330 } +00331 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere4" doxytag="NLNET::CNetManager::addServer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addServer </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>servicePort</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">NLNET::TServiceId</a> & </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>external</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00207">207</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00058">_RecordingState</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a05512.html#l00093">NLNET::CBufServer::init()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a06098.html#l00062">NLNET::nmNewConnection()</a>, <a class="el" href="a06098.html#l00074">NLNET::nmNewDisconnection()</a>, <a class="el" href="a05529.html#l00061">NLNET::CCallbackServer::setConnectionCallback()</a>, <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, <a class="el" href="a05981.html#l00105">uint</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>00208 { +00209 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: Adding server '%s' in CNetManager"</span>, serviceName.c_str ()); +00210 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00211 +00212 <span class="comment">// check if it's a new server</span> +00213 <a class="code" href="a04199.html#a6">nlassert</a> ((*itbm).second.NetBase.empty()); +00214 +00215 CCallbackServer *cs = <span class="keyword">new</span> CCallbackServer( _RecordingState, serviceName+string(<span class="stringliteral">".nmr"</span>) ); +00216 (*itbm).second.NetBase.push_back (cs); +00217 +00218 (*itbm).second.Type = CBaseStruct::Server; +00219 +00220 <span class="comment">// install the server</span> +00221 +00222 cs->setConnectionCallback (nmNewConnection, (<span class="keywordtype">void</span>*) &((*itbm).second)); +00223 cs->CCallbackNetBase::setDisconnectionCallback (nmNewDisconnection, (<span class="keywordtype">void</span>*) &((*itbm).second)); +00224 +00225 <span class="keywordflow">if</span> (servicePort == 0) +00226 { +00227 <a class="code" href="a04199.html#a6">nlassert</a> (CNamingClient::connected ()); +00228 servicePort = CNamingClient::queryServicePort (); +00229 } +00230 +00231 cs->init (servicePort); +00232 +00233 <span class="comment">// register the server to the naming service if we are connected to Naming Service</span> +00234 +00235 <span class="keywordflow">if</span> (CNamingClient::connected () && !external) +00236 { +00237 <span class="comment">//CInetAddress addr = CInetAddress::localHost ();</span> +00238 <span class="comment">//addr.setPort (servicePort);</span> +00239 vector<CInetAddress> <a class="code" href="a04223.html#a657">addr</a> = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +00240 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a15">uint</a> i = 0; i < <a class="code" href="a04223.html#a657">addr</a>.size(); i++) +00241 <a class="code" href="a04223.html#a657">addr</a>[i].setPort(servicePort); +00242 +00243 <span class="keywordflow">if</span> (sid == 0) +00244 { +00245 CNamingClient::registerService (serviceName, addr, sid); +00246 } +00247 <span class="keywordflow">else</span> +00248 { +00249 CNamingClient::registerServiceWithSId (serviceName, addr, sid); +00250 } +00251 } +00252 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL4: Server '%s' added, registered and listen to port %hu"</span>, serviceName.c_str (), servicePort); +00253 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere5" doxytag="NLNET::CNetManager::addServer" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::addServer </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a04558.html#a9">uint16</a> </td> + <td class="mdname" nowrap> <em>servicePort</em> = 0, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>bool </td> + <td class="mdname" nowrap> <em>external</em> = false</td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets up a server on a specific port with a specific service name (create a listen socket, register to naming service and so on) If servicePort is 0, it will be dynamically determinated by the Naming Service. If sid id 0, the service id will be dynamically determinated by the Naming Service. +<p> +Definition at line <a class="el" href="a06098.html#l00201">201</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06090.html#l00042">NLNET::TServiceId</a>, and <a class="el" href="a05981.html#l00098">uint16</a>. +<p> +<div class="fragment"><pre>00202 { +00203 <a class="code" href="a05379.html#a93">TServiceId</a> sid = 0; +00204 <a class="code" href="a02987.html#NLNET_1_1CNetManagere5">addServer</a> (serviceName, servicePort, sid, external); +00205 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere6" doxytag="NLNET::CNetManager::createConnection" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::createConnection </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a02257.html">CBaseStruct</a> & </td> + <td class="mdname" nowrap> <em>Base</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02665.html">CInetAddress</a> & </td> + <td class="mdname" nowrap> <em>Addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::string & </td> + <td class="mdname" nowrap> <em>name</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00097">97</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00058">_RecordingState</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05524.html#l00272">NLNET::CCallbackClient::getSockId()</a>, <a class="el" href="a06099.html#l00076">NLNET::CBaseStruct::NetBase</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a06098.html#l00074">NLNET::nmNewDisconnection()</a>, and <a class="el" href="a05981.html#l00105">uint</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00256">addClient()</a>, and <a class="el" href="a06098.html#l00307">addGroup()</a>. +<p> +<div class="fragment"><pre>00098 { +00099 <a class="code" href="a04558.html#a15">uint</a> i; +00100 <span class="keywordflow">for</span> (i = 0; i < Base.NetBase.size (); i++) +00101 { +00102 <span class="keywordflow">if</span> (!Base.NetBase[i]->connected ()) +00103 { +00104 <span class="keywordflow">break</span>; +00105 } +00106 } +00107 <span class="keywordflow">if</span> (i == Base.NetBase.size ()) +00108 { +00109 CCallbackClient *cc = <span class="keyword">new</span> CCallbackClient( _RecordingState, name+string(<span class="stringliteral">".nmr"</span>) ); +00110 Base.NetBase.push_back (cc); +00111 } +00112 +00113 CCallbackClient *cc = dynamic_cast<CCallbackClient *>(Base.NetBase[i]); +00114 +00115 cc->CCallbackNetBase::setDisconnectionCallback (nmNewDisconnection, (<span class="keywordtype">void</span>*) &Base); +00116 +00117 <span class="keywordflow">try</span> +00118 { +00119 cc->connect (Addr); +00120 +00121 <span class="keywordflow">if</span> (Base.ConnectionCallback != NULL) +00122 Base.ConnectionCallback (Base.Name, cc->getSockId(), Base.ConnectionCbArg); +00123 } +00124 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e) +00125 { +00126 <a class="code" href="a04199.html#a1">nlinfo</a> (<span class="stringliteral">"HNETL4: can't connect now (%s)"</span>, e.what ()); +00127 } +00128 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagerh0" doxytag="NLNET::CNetManager::find" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02987.html#NLNET_1_1CNetManagery0">CNetManager::ItBaseMap</a> NLNET::CNetManager::find </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>serviceName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static, private]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00489">489</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, and <a class="el" href="a06099.html#l00171">ItBaseMap</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00346">addCallbackArray()</a>, <a class="el" href="a06098.html#l00256">addClient()</a>, <a class="el" href="a06098.html#l00307">addGroup()</a>, <a class="el" href="a06098.html#l00207">addServer()</a>, <a class="el" href="a06098.html#l00466">getNetBase()</a>, <a class="el" href="a06098.html#l00335">getSIDA()</a>, <a class="el" href="a06098.html#l00455">send()</a>, <a class="el" href="a06098.html#l00472">setConnectionCallback()</a>, and <a class="el" href="a06098.html#l00480">setDisconnectionCallback()</a>. +<p> +<div class="fragment"><pre>00490 { +00491 <span class="comment">// find the service or add it if not found</span> +00492 pair<ItBaseMap, bool> p; +00493 p = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.insert (make_pair (serviceName, CBaseStruct (serviceName))); +00494 <span class="keywordflow">return</span> p.first; +00495 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere7" doxytag="NLNET::CNetManager::getBytesReceived" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CNetManager::getBytesReceived </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00510">510</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +<div class="fragment"><pre>00511 { +00512 <a class="code" href="a04558.html#a13">uint64</a> received = 0; +00513 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00514 { +00515 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00516 { +00517 received += (*itbm).second.NetBase[i]->getBytesReceived (); +00518 } +00519 } +00520 <span class="keywordflow">return</span> received; +00521 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere8" doxytag="NLNET::CNetManager::getBytesSent" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CNetManager::getBytesSent </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00497">497</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +<div class="fragment"><pre>00498 { +00499 <a class="code" href="a04558.html#a13">uint64</a> sent = 0; +00500 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00501 { +00502 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00503 { +00504 sent += (*itbm).second.NetBase[i]->getBytesSent (); +00505 } +00506 } +00507 <span class="keywordflow">return</span> sent; +00508 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere9" doxytag="NLNET::CNetManager::getNetBase" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02306.html">CCallbackNetBase</a> * NLNET::CNetManager::getNetBase </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>serviceName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Returns the connection if you want to do specific calls. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00466">466</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00489">find()</a>, and <a class="el" href="a06099.html#l00171">ItBaseMap</a>. +<p> +<div class="fragment"><pre>00467 { +00468 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00469 <span class="keywordflow">return</span> (*itbm).second.NetBase[0]; +00470 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere10" doxytag="NLNET::CNetManager::getReceiveQueueSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CNetManager::getReceiveQueueSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00536">536</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +<div class="fragment"><pre>00537 { +00538 <a class="code" href="a04558.html#a13">uint64</a> val = 0; +00539 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00540 { +00541 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00542 { +00543 val += (*itbm).second.NetBase[i]->getReceiveQueueSize (); +00544 } +00545 } +00546 <span class="keywordflow">return</span> val; +00547 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere11" doxytag="NLNET::CNetManager::getSendQueueSize" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a04558.html#a13">uint64</a> NLNET::CNetManager::getSendQueueSize </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00523">523</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05981.html#l00100">uint32</a>, and <a class="el" href="a05981.html#l00102">uint64</a>. +<p> +<div class="fragment"><pre>00524 { +00525 <a class="code" href="a04558.html#a13">uint64</a> val = 0; +00526 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00527 { +00528 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00529 { +00530 val += (*itbm).second.NetBase[i]->getSendQueueSize (); +00531 } +00532 } +00533 <span class="keywordflow">return</span> val; +00534 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere12" doxytag="NLNET::CNetManager::getSIDA" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a03449.html">NLMISC::CStringIdArray</a> & NLNET::CNetManager::getSIDA </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname1" valign="top" nowrap> <em>serviceName</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Use this function to get the String ID Array needed when you want to create a message. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00335">335</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, and <a class="el" href="a05622.html#l00101">nldebug</a>. +<p> +<div class="fragment"><pre>00336 { +00337 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: getSIDA() for service '%s'"</span>, serviceName.c_str ()); +00338 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00339 +00340 <span class="comment">// in case of group, we can return association only if there s only one service on it</span> +00341 <a class="code" href="a04199.html#a6">nlassert</a> ((*itbm).second.NetBase.size() == 1); +00342 +00343 <span class="keywordflow">return</span> (*itbm).second.NetBase[0]->getSIDA (); +00344 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere13" doxytag="NLNET::CNetManager::init" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::init </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const <a class="el" href="a02665.html">CInetAddress</a> * </td> + <td class="mdname" nowrap> <em>addr</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> </td> + <td class="mdname" nowrap> <em>rec</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Creates the connection to the Naming Service. If the connection failed, <a class="el" href="a03812.html">ESocketConnectionFailed</a> exception is generated. +<p> +Definition at line <a class="el" href="a06098.html#l00169">169</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00058">_RecordingState</a>, <a class="el" href="a05646.html#l01127">addr</a>, <a class="el" href="a06098.html#l00131">NLNET::RegistrationBroadcast()</a>, and <a class="el" href="a06098.html#l00164">NLNET::UnregistrationBroadcast()</a>. +<p> +<div class="fragment"><pre>00170 { +00171 <span class="keywordflow">if</span> (<a class="code" href="a04223.html#a657">addr</a> == NULL) <span class="keywordflow">return</span>; +00172 +00173 <a class="code" href="a02987.html#NLNET_1_1CNetManagerv2">_RecordingState</a> = rec; +00174 +00175 <span class="comment">// connect to the naming service (may generate a ESocketConnectionFailed exception)</span> +00176 +00177 vector<CInetAddress> laddr = <a class="code" href="a02665.html#NLNET_1_1CInetAddresse0">CInetAddress::localAddresses</a>(); +00178 CNamingClient::connect( *addr, _RecordingState, laddr ); +00179 +00180 <span class="comment">// connect the callback to know when a new service comes in or goes down</span> +00181 CNamingClient::setRegistrationBroadcastCallback (RegistrationBroadcast); +00182 CNamingClient::setUnregistrationBroadcastCallback (UnregistrationBroadcast); +00183 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere14" doxytag="NLNET::CNetManager::release" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::release </td> + <td class="md" valign="top">( </td> + <td class="mdname1" valign="top" nowrap> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00185">185</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00186 { +00187 <span class="keywordflow">if</span> (CNamingClient::connected ()) +00188 CNamingClient::disconnect (); +00189 +00190 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00191 { +00192 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00193 { +00194 (*itbm).second.NetBase[i]->disconnect (); +00195 <span class="keyword">delete</span> (*itbm).second.NetBase[i]; +00196 } +00197 } +00198 <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.clear (); +00199 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere15" doxytag="NLNET::CNetManager::send" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::send </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const <a class="el" href="a02918.html">CMessage</a> & </td> + <td class="mdname" nowrap> <em>buffer</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a02303.html">TSockId</a> </td> + <td class="mdname" nowrap> <em>hostid</em> = <a class="el" href="a05379.html#a75">InvalidSockId</a></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sends a message to a specific serviceName. +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00455">455</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a05514.html#l00329">NLNET::CBufSock::asString()</a>, <a class="el" href="a05646.html#l00649">buffer</a>, <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, <a class="el" href="a05511.html#l00042">NLNET::TSockId</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00456 { +00457 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: send for service '%s' message %s to %s"</span>, serviceName.c_str(), <a class="code" href="a04223.html#a589">buffer</a>.toString().c_str(), hostid->asString().c_str()); +00458 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00459 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00460 { +00461 <span class="keywordflow">if</span> ((*itbm).second.NetBase[i]->connected()) +00462 (*itbm).second.NetBase[i]->send (buffer, hostid); +00463 } +00464 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere16" doxytag="NLNET::CNetManager::setConnectionCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::setConnectionCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a95">TNetManagerCallback</a> </td> + <td class="mdname" nowrap> <em>cb</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets callback for incoming connections (or NULL to disable callback) On a client, the callback will be call when the connection to the server is established (the first connection or after the server shutdown and started) On a server, the callback is called each time a new client is connected to him +<p> +Definition at line <a class="el" href="a06098.html#l00472">472</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, and <a class="el" href="a06099.html#l00052">NLNET::TNetManagerCallback</a>. +<p> +<div class="fragment"><pre>00473 { +00474 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: setConnectionCallback() for service '%s'"</span>, serviceName.c_str ()); +00475 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00476 (*itbm).second.ConnectionCallback = cb; +00477 (*itbm).second.ConnectionCbArg = arg; +00478 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere17" doxytag="NLNET::CNetManager::setDisconnectionCallback" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::setDisconnectionCallback </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>serviceName</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a95">TNetManagerCallback</a> </td> + <td class="mdname" nowrap> <em>cb</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>void * </td> + <td class="mdname" nowrap> <em>arg</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Sets callback for disconnections (or NULL to disable callback) On a client, the callback will be call each time the connection to the server is lost On a server, the callback is called each time a client is disconnected +<p> +Definition at line <a class="el" href="a06098.html#l00480">480</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00101">nldebug</a>, and <a class="el" href="a06099.html#l00052">NLNET::TNetManagerCallback</a>. +<p> +<div class="fragment"><pre>00481 { +00482 <a class="code" href="a04199.html#a0">nldebug</a> (<span class="stringliteral">"HNETL4: setDisconnectionCallback() for service '%s'"</span>, serviceName.c_str ()); +00483 <a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerh0">find</a> (serviceName); +00484 (*itbm).second.DisconnectionCallback = cb; +00485 (*itbm).second.DisconnectionCbArg = arg; +00486 } +</pre></div> </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere18" doxytag="NLNET::CNetManager::setUpdateTimeout" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::setUpdateTimeout </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a04558.html#a11">uint32</a> </td> + <td class="mdname1" valign="top" nowrap> <em>timeout</em> </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagere19" doxytag="NLNET::CNetManager::update" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void NLNET::CNetManager::update </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top"><a class="el" href="a05378.html#a242">NLMISC::TTime</a> </td> + <td class="mdname1" valign="top" nowrap> <em>timeout</em> = 0 </td> + <td class="md" valign="top"> ) </td> + <td class="md" nowrap><code> [static]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> +Call it evenly. the parameter select the timeout value in milliseconds for each update. You are absolutely certain that this function will not be returns before this amount of time you set. If you set the update timeout value higher than 0, all messages in queues will be process until the time is greater than the timeout user <a class="el" href="a02987.html#NLNET_1_1CNetManagere19">update()</a>. If you set the update timeout value to 0, all messages in queues will be process one time before calling the user <a class="el" href="a02987.html#NLNET_1_1CNetManagere19">update()</a>. In this case, we don't nlSleep(1). +<p> +<dl compact><dt><b><a class="el" href="todo.html#_todo000039">Todo:</a></b></dt><dd>ace: <a class="el" href="a02987.html#NLNET_1_1CNetManagere19">update()</a> only when connected () but cado must fix the problem before because if we don't update when we are not connected, we don't receive the disconnection</dd></dl> + +<p> +Definition at line <a class="el" href="a06098.html#l00357">357</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +References <a class="el" href="a06098.html#l00056">_BaseMap</a>, <a class="el" href="a06098.html#l00060">_NextUpdateTime</a>, <a class="el" href="a05524.html#l00286">NLNET::CCallbackClient::connect()</a>, <a class="el" href="a05524.html#l00272">NLNET::CCallbackClient::getSockId()</a>, <a class="el" href="a06099.html#l00171">ItBaseMap</a>, <a class="el" href="a05622.html#l00290">nlassert</a>, <a class="el" href="a05622.html#l00111">nlinfo</a>, <a class="el" href="a05586.html#l00073">NLMISC::nlSleep()</a>, <a class="el" href="a06553.html#l00047">NLMISC::TTime</a>, and <a class="el" href="a05981.html#l00100">uint32</a>. +<p> +<div class="fragment"><pre>00358 { +00359 <span class="comment">// nldebug ("HNETL4: update()");</span> +00360 +00361 <span class="comment">// sint64 p1 = CTime::getPerformanceTime ();</span> +00362 +00363 <a class="code" href="a05378.html#a242">TTime</a> t0 = CTime::getLocalTime (); +00364 +00365 <span class="keywordflow">if</span> (timeout > 0) +00366 { +00367 <span class="keywordflow">if</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a> == 0) +00368 { +00369 <a class="code" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a> = t0 + timeout; +00370 } +00371 <span class="keywordflow">else</span> +00372 { +00373 <a class="code" href="a05378.html#a242">TTime</a> err = t0 - <a class="code" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a>; +00374 <a class="code" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a> += timeout; +00375 +00376 <span class="comment">// if we are too late, resync to the next value</span> +00377 <span class="keywordflow">while</span> (err > timeout) +00378 { +00379 err -= timeout; +00380 <a class="code" href="a02987.html#NLNET_1_1CNetManagerv1">_NextUpdateTime</a> += timeout; +00381 } +00382 +00383 timeout -= err; +00384 <span class="keywordflow">if</span> (timeout < 0) timeout = 0; +00385 } +00386 } +00387 +00388 <span class="comment">// sint64 p2 = CTime::getPerformanceTime ();</span> +00389 +00390 <span class="keywordflow">while</span> (<span class="keyword">true</span>) +00391 { +00392 <span class="keywordflow">for</span> (<a class="code" href="a02987.html#NLNET_1_1CNetManagery0">ItBaseMap</a> itbm = <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.begin (); itbm != <a class="code" href="a02987.html#NLNET_1_1CNetManagerv0">_BaseMap</a>.end (); itbm++) +00393 { +00394 <span class="keywordflow">for</span> (<a class="code" href="a04558.html#a11">uint32</a> i = 0; i < (*itbm).second.NetBase.size(); i++) +00395 { +00397 <span class="comment">// we get and treat all messages in this connection</span> +00398 (*itbm).second.NetBase[i]->update (0); +00399 <span class="keywordflow">if</span> ((*itbm).second.NetBase[i]->connected()) +00400 { +00401 <span class="comment">// if connected, update</span> +00402 <span class="comment">// (*itbm).second.NetBase[i]->update ();</span> +00403 } +00404 <span class="keywordflow">else</span> +00405 { +00406 <span class="keyword">static</span> <a class="code" href="a05378.html#a242">TTime</a> lastTime = CTime::getLocalTime(); +00407 <span class="keywordflow">if</span> (CTime::getLocalTime() - lastTime > 5000) +00408 { +00409 lastTime = CTime::getLocalTime(); +00410 +00411 <span class="comment">// if not connected, try to connect ClientWithAddr</span> +00412 <span class="keywordflow">if</span> ((*itbm).second.Type == CBaseStruct::ClientWithAddr && (*itbm).second.AutoRetry) +00413 { +00414 CCallbackClient *cc = dynamic_cast<CCallbackClient *>((*itbm).second.NetBase[i]); +00415 <span class="keywordflow">try</span> +00416 { +00417 <a class="code" href="a04199.html#a6">nlassert</a> ((*itbm).second.ServiceNames.size()==1); +00418 cc->connect (<a class="code" href="a02665.html">CInetAddress</a>((*itbm).second.ServiceNames[0])); +00419 +00420 <span class="keywordflow">if</span> ((*itbm).second.ConnectionCallback != NULL) +00421 (*itbm).second.ConnectionCallback ((*itbm).second.Name, cc->getSockId(), (*itbm).second.ConnectionCbArg); +00422 } +00423 <span class="keywordflow">catch</span> (ESocketConnectionFailed &e) +00424 { +00425 <span class="comment">// can't connect now, try later</span> +00426 <a class="code" href="a04199.html#a1">nlinfo</a>(<span class="stringliteral">"HNETL4: can't connect now to %s (reason: %s)"</span>, (*itbm).second.ServiceNames[0].c_str(), e.what()); +00427 } +00428 } +00429 } +00430 } +00431 } +00432 } +00433 +00434 <span class="comment">// If it's the end, don't nlSleep()</span> +00435 <span class="keywordflow">if</span> (CTime::getLocalTime() - t0 > timeout) +00436 <span class="keywordflow">break</span>; +00437 +00438 <span class="comment">// Enable windows multithreading before rescanning all connections</span> +00439 <span class="comment">// slow down the layer H_BEFORE (CNetManager_update_nlSleep);</span> +00440 <a class="code" href="a05378.html#a256">nlSleep</a> (1); +00441 <span class="comment">// slow down the layer H_AFTER (CNetManager_update_nlSleep);</span> +00442 } +00443 +00444 <span class="comment">// sint64 p3 = CTime::getPerformanceTime ();</span> +00445 +00446 <span class="keywordflow">if</span> (CNamingClient::connected ()) +00447 CNamingClient::update (); +00448 +00449 <span class="comment">// sint64 p4 = CTime::getPerformanceTime ();</span> +00450 +00451 <span class="comment">// nlinfo("time : %f %f %f %d", CTime::ticksToSecond(p2-p1), CTime::ticksToSecond(p3-p2), CTime::ticksToSecond(p4-p3), timeout);</span> +00452 } +</pre></div> </td> + </tr> +</table> +<hr><h2>Friends And Related Function Documentation</h2> +<a class="anchor" name="NLNET_1_1CNetManagern0" doxytag="NLNET::CNetManager::RegistrationBroadcast" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> void RegistrationBroadcast </td> + <td class="md" valign="top">( </td> + <td class="md" nowrap valign="top">const std::string & </td> + <td class="mdname" nowrap> <em>name</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap><a class="el" href="a05379.html#a93">TServiceId</a> </td> + <td class="mdname" nowrap> <em>sid</em>, </td> + </tr> + <tr> + <td class="md" nowrap align="right"></td> + <td></td> + <td class="md" nowrap>const std::vector< <a class="el" href="a02665.html">CInetAddress</a> > & </td> + <td class="mdname" nowrap> <em>addr</em></td> + </tr> + <tr> + <td></td> + <td class="md">) </td> + <td class="md" colspan="2"><code> [friend]</code></td> + </tr> + + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + </td> + </tr> +</table> +<hr><h2>Field Documentation</h2> +<a class="anchor" name="NLNET_1_1CNetManagerv0" doxytag="NLNET::CNetManager::_BaseMap" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02987.html#NLNET_1_1CNetManagery1">CNetManager::TBaseMap</a> <a class="el" href="a02987.html#NLNET_1_1CNetManagerv0">NLNET::CNetManager::_BaseMap</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00056">56</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00489">find()</a>, <a class="el" href="a06098.html#l00510">getBytesReceived()</a>, <a class="el" href="a06098.html#l00497">getBytesSent()</a>, <a class="el" href="a06098.html#l00536">getReceiveQueueSize()</a>, <a class="el" href="a06098.html#l00523">getSendQueueSize()</a>, <a class="el" href="a06098.html#l00185">release()</a>, and <a class="el" href="a06098.html#l00357">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagerv1" doxytag="NLNET::CNetManager::_NextUpdateTime" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> TTime <a class="el" href="a02987.html#NLNET_1_1CNetManagerv1">NLNET::CNetManager::_NextUpdateTime</a> = 0<code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00060">60</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00357">update()</a>. </td> + </tr> +</table> +<a class="anchor" name="NLNET_1_1CNetManagerv2" doxytag="NLNET::CNetManager::_RecordingState" ></a><p> +<table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> + <tr> + <td class="mdRow"> + <table cellpadding="0" cellspacing="0" border="0"> + <tr> + <td class="md" nowrap valign="top"> <a class="el" href="a02306.html#NLNET_1_1CCallbackServerw8">CCallbackNetBase::TRecordingState</a> <a class="el" href="a02987.html#NLNET_1_1CNetManagerv2">NLNET::CNetManager::_RecordingState</a><code> [static, private]</code> + </table> + </td> + </tr> +</table> +<table cellspacing=5 cellpadding=0 border=0> + <tr> + <td> + + </td> + <td> + +<p> + +<p> +Definition at line <a class="el" href="a06098.html#l00058">58</a> of file <a class="el" href="a06098.html">net_manager.cpp</a>. +<p> +Referenced by <a class="el" href="a06098.html#l00280">addClient()</a>, <a class="el" href="a06098.html#l00207">addServer()</a>, <a class="el" href="a06098.html#l00097">createConnection()</a>, and <a class="el" href="a06098.html#l00169">init()</a>. </td> + </tr> +</table> +<hr>The documentation for this class was generated from the following files:<ul> +<li><a class="el" href="a06099.html">net_manager.h</a><li><a class="el" href="a06098.html">net_manager.cpp</a></ul> +<hr size="1"><address style="align: right;"><small>Generated on Tue Mar 16 14:01:48 2004 for NeL by +<a href="http://www.doxygen.org/index.html"> +<img src="doxygen.png" alt="doxygen" align="middle" border=0 > +</a>1.3.6 </small></address> +</body> +</html> |