-
Notifications
You must be signed in to change notification settings - Fork 0
/
_net.html
261 lines (259 loc) · 24.5 KB
/
_net.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Nebula: Net</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="custom.css" rel="stylesheet" type="text/css"/>
<link href="custom_dark_theme.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Nebula
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function(){initNavTree('_net.html',''); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div><div class="header">
<div class="headertitle"><div class="title">Net</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="NebulaNetSystem"></a>
The Net Subsystem</h1>
<p>The <a class="el" href="namespace_nebula.html">Nebula</a> <a class="el" href="namespace_net.html">Net</a> subsystem offers simple client/server-style communication using the TCP protocol over LAN or internet connections. It is not intended for highlevel game-oriented communication with lobbies, session management and synchronisation of player data. This will be provided in higher level <a class="el" href="namespace_nebula.html">Nebula</a> networking subsystems.</p>
<h2><a class="anchor" id="NetIPAddress"></a>
Working with IP addresses</h2>
<p>An IpAddress object identifies a communication endpoint by host name or tcp/ip address and a port number. IpAddress objects can be created in a number of ways:</p>
<div class="fragment"><div class="line"><span class="comment">// from TCP/IP address and port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"192.168.0.2"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from host name and port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"www.radonlabs.de"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from the local host (127.0.0.1) and port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"localhost"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from the "any" address (0.0.0.0) and a port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"any"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from the broadcast address (255.255.255.255) and a port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"broadcast"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from the host's first valid network adapter's address and a port number</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"self"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from the host's first valid network adapter connected to the internet and a port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"insetself"</span>, 1234);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// from an URI which defines a host name and a port number:</span></div>
<div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<a class="code hl_class" href="class_i_o_1_1_u_r_i.html">IO::URI</a>(<span class="stringliteral">"http://www.radonlabs.de:2100"</span>));</div>
<div class="ttc" id="aclass_i_o_1_1_u_r_i_html"><div class="ttname"><a href="class_i_o_1_1_u_r_i.html">IO::URI</a></div><div class="ttdoc">An URI object can split a Uniform Resource Identifier string into its components or build a string fr...</div><div class="ttdef"><b>Definition</b> uri.h:67</div></div>
<div class="ttc" id="aclass_net_1_1_ip_address_html"><div class="ttname"><a href="class_net_1_1_ip_address.html">IpAddress</a></div><div class="ttdoc">Represents an IP address, consisting of a IPv4 host address and a port number.</div></div>
</div><!-- fragment --><p>An IpAddress object can be used to lookup a TCP/IP address from a host name:</p>
<div class="fragment"><div class="line"><a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a> ipAddr(<span class="stringliteral">"www.radonlabs.de"</span>, 0);</div>
<div class="line">String numericalAddr = ipAddr.GetHostAddr();</div>
</div><!-- fragment --><h2><a class="anchor" id="NetTcpServerClient"></a>
Setting Up A Client/Server System</h2>
<p>The <a class="el" href="namespace_net.html">Net</a> subsystem provides an easy-to-use TCP-based client/server system implemented in the classes TcpServer and TcpClient using the TCP protocol. Any number of TcpClients can be served by a single TcpServer simultanously.</p>
<p>Setting up a server is done like this:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_net.html">Net</a>;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_class" href="class_ptr.html">Ptr<TcpServer></a> tcpServer = TcpServer::Create();</div>
<div class="line">tcpServer->SetAddress(<a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a>(<span class="stringliteral">"any"</span>, 2352));</div>
<div class="line"><span class="keywordflow">if</span> (tcpServer->Open())</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// TcpServer successfully opened</span></div>
<div class="line">}</div>
<div class="ttc" id="aclass_ptr_html"><div class="ttname"><a href="class_ptr.html">Ptr</a></div><div class="ttdoc">Nebula's smart pointer class which manages the life time of RefCounted objects.</div><div class="ttdef"><b>Definition</b> ptr.h:38</div></div>
<div class="ttc" id="anamespace_net_html"><div class="ttname"><a href="namespace_net.html">Net</a></div><div class="ttdef"><b>Definition</b> debugmessage.h:20</div></div>
</div><!-- fragment --><p>This will setup the server to listen on port 2352 for incoming client connection requests.</p>
<p>To communicate with the TcpServer, a TcpClient object needs to be setup on the client side:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_net.html">Net</a>;</div>
<div class="line"> </div>
<div class="line"><a class="code hl_class" href="class_ptr.html">Ptr<TcpClient></a> tcpClient = TcpClient::Create();</div>
<div class="line">tcpClient->SetBlocking(<span class="keyword">false</span>);</div>
<div class="line">tcpClient->SetAddress(<a class="code hl_class" href="class_net_1_1_ip_address.html">IpAddress</a>(<span class="stringliteral">"localhost"</span>, 2352));</div>
<div class="line">TcpClient::Result res = tcpClient->Connect();</div>
</div><!-- fragment --><p>This assumes that the server is running on the same machine as the client (since the client connects to "localhost").</p>
<p>In a non-blocking scenario as above, the Connect() method will either return with TcpClient::Success (which means the connection is established), or more likely with TcpClient::Connecting, in this case the connection hasn't been established yet, and the application needs to continue calling the Connect() method. In the case of an connection error, the return code TcpClient::Error will be returned.</p>
<p>In a blocking scenario the Connect() method will not return until either the connection has been established (result would be TcpClient::Success) or an error occured (TcpClient::Error).</p>
<dl class="section note"><dt>Note</dt><dd>An interactive application should never block during network communication and instead should provide continous feedback to the user what's going on.</dd></dl>
<p>Once a connection has been established, a TcpClientConnection object will be created on the server side for each connected client. The TcpClientConnection represents the client on the server and is used to receive data from the client and to send responses back to the client.</p>
<p>For sending and receiving data, <a class="el" href="class_i_o_1_1_stream.html" title="Offers an abstract interface for read/write access to a sequence of bytes.">IO::Stream</a> objects are used. By attaching <a class="el" href="class_i_o_1_1_stream_reader.html" title="Stream reader classes provide a specialized read-interface for a stream.">IO::StreamReader</a> and <a class="el" href="class_i_o_1_1_stream_writer.html" title="Stream writer classes provide a specialized write-interface for a stream.">IO::StreamWriter</a> objects to the communication streams it is very easy to encode and decode data from the stream.</p>
<dl class="section note"><dt>Note</dt><dd>Send-data is not sent immediately, instead the data will accumulate in the send stream until the Send() method is called.</dd></dl>
<p>To send some text data from a client to its server, obtain a pointer to the send stream, write data to it and call the Send() method:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_net.html">Net</a>;</div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_i_o.html">IO</a>;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// obtain pointer to client's send stream and attach a TextWriter</span></div>
<div class="line"><span class="keyword">const</span> <a class="code hl_class" href="class_ptr.html">Ptr<Stream></a>& sendStream = tcpClient->GetSendStream();</div>
<div class="line"><a class="code hl_class" href="class_ptr.html">Ptr<TextWriter></a> textWriter = TextWriter::Create();</div>
<div class="line">textWriter->SetStream(sendStream);</div>
<div class="line">textWriter->Open())</div>
<div class="line">textWriter->WriteString(<span class="stringliteral">"Hello Server"</span>);</div>
<div class="line">textWriter->Close();</div>
<div class="line"> </div>
<div class="line"><span class="comment">// send off the data to the server</span></div>
<div class="line"><span class="keywordflow">if</span> (this->tcpClient->Send())</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// data has been sent</span></div>
<div class="line">}</div>
<div class="ttc" id="anamespace_i_o_html"><div class="ttname"><a href="namespace_i_o.html">IO</a></div><div class="ttdoc">Instances of wrapped stream classes.</div><div class="ttdef"><b>Definition</b> orientation.cc:10</div></div>
</div><!-- fragment --><p>To receive client data on the server side, the application needs to poll for TcpClientConnection which contain data from clients frequently (e.g. once per frame). More then one TcpClientConnection may be waiting for processing, thus the processing loop should look like this:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_util.html">Util</a>;</div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_i_o.html">IO</a>;</div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_net.html">Net</a>;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// get array of client connections which received data since the last time</span></div>
<div class="line"><a class="code hl_class" href="class_util_1_1_array.html">Array<Ptr<TcpClientConnection></a>> recvConns = tcpServer->Recv();</div>
<div class="line"><a class="code hl_typedef" href="types_8h.html#ad119735112d40fd29a3017de944ccc98">IndexT</a> i;</div>
<div class="line"><span class="keywordflow">for</span> (i = 0; i < recvConns.<a class="code hl_function" href="class_util_1_1_array.html#ae8fbfc046ebad5c3c5930942d91832f6">Size</a>(); i++)</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// get receive stream from current connection, attach a text reader and read content</span></div>
<div class="line"> <a class="code hl_class" href="class_ptr.html">Ptr<TextReader></a> textReader = TextReader::Create();</div>
<div class="line"> textReader->SetStream(recvConns[i]->GetRecvStream());</div>
<div class="line"> textReader->Open();</div>
<div class="line"> <a class="code hl_class" href="struct_util_1_1_string.html">String</a> str = textReader->ReadString();</div>
<div class="line"> textReader->Close();</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// process received string and send response back to client</span></div>
<div class="line"> <span class="comment">// create a TextWriter and attach it to the send stream of the client connection</span></div>
<div class="line"> <a class="code hl_class" href="class_ptr.html">Ptr<TextWriter></a> textWriter = TextWriter::Create();</div>
<div class="line"> textWriter->SetStream(recvConns[i]->GetSendStream());</div>
<div class="line"> textWriter->Open();</div>
<div class="line"> textWriter->WriteString(<span class="stringliteral">"Hello Client"</span>);</div>
<div class="line"> textWriter->Close();</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// finally send the response back to the client</span></div>
<div class="line"> recvConns[i]->Send();</div>
<div class="line">}</div>
<div class="ttc" id="aclass_util_1_1_array_html"><div class="ttname"><a href="class_util_1_1_array.html">Util::Array</a></div><div class="ttdoc">Nebula's dynamic array class.</div><div class="ttdef"><b>Definition</b> array.h:60</div></div>
<div class="ttc" id="aclass_util_1_1_array_html_ae8fbfc046ebad5c3c5930942d91832f6"><div class="ttname"><a href="class_util_1_1_array.html#ae8fbfc046ebad5c3c5930942d91832f6">Util::Array::Size</a></div><div class="ttdeci">const SizeT Size() const</div><div class="ttdoc">get number of elements in array</div><div class="ttdef"><b>Definition</b> array.h:880</div></div>
<div class="ttc" id="anamespace_util_html"><div class="ttname"><a href="namespace_util.html">Util</a></div><div class="ttdoc">A pinned array is an array which manages its own virtual memory.</div><div class="ttdef"><b>Definition</b> String.cs:6</div></div>
<div class="ttc" id="astruct_util_1_1_string_html"><div class="ttname"><a href="struct_util_1_1_string.html">Util::String</a></div><div class="ttdoc">Nebula's universal string class.</div><div class="ttdef"><b>Definition</b> string.h:50</div></div>
<div class="ttc" id="atypes_8h_html_ad119735112d40fd29a3017de944ccc98"><div class="ttname"><a href="types_8h.html#ad119735112d40fd29a3017de944ccc98">IndexT</a></div><div class="ttdeci">int IndexT</div><div class="ttdef"><b>Definition</b> types.h:48</div></div>
</div><!-- fragment --><p>To get server responses on the client side, call the TcpClient::Recv() method which will block until data arrives (in blocking mode), or come back immediately (in non-blocking mode) and return true when data from the server is available:</p>
<div class="fragment"><div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_net.html">Net</a>;</div>
<div class="line"><span class="keyword">using namespace </span><a class="code hl_namespace" href="namespace_i_o.html">IO</a>;</div>
<div class="line"> </div>
<div class="line"><span class="comment">// check if data is available from the server</span></div>
<div class="line"><span class="keywordflow">if</span> (tcpClient->Recv())</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// yep, data is available, get the recv stream and read the data from it</span></div>
<div class="line"> <span class="keyword">const</span> <a class="code hl_class" href="class_ptr.html">Ptr<Stream></a>& recvStream = tcpClient->GetRecvStream();</div>
<div class="line"> <a class="code hl_class" href="class_ptr.html">Ptr<TextReader></a> textReader = TextReader::Create();</div>
<div class="line"> textReader->SetStream(recvStream);</div>
<div class="line"> textReader->Open();</div>
<div class="line"> <a class="code hl_class" href="struct_util_1_1_string.html">String</a> responseString = textReader->ReadString();</div>
<div class="line"> <a class="code hl_function" href="debug_8cc.html#af49bb380724a6d5744e97bae90dbb5ae">n_printf</a>(<span class="stringliteral">"The server said: %s\n"</span>, responseString.<a class="code hl_function" href="struct_util_1_1_string.html#aae44fd420cacbfa974b220218a3732c0">AsCharPtr</a>());</div>
<div class="line"> textReader->Close();</div>
<div class="line">}</div>
<div class="ttc" id="adebug_8cc_html_af49bb380724a6d5744e97bae90dbb5ae"><div class="ttname"><a href="debug_8cc.html#af49bb380724a6d5744e97bae90dbb5ae">n_printf</a></div><div class="ttdeci">void __cdecl n_printf(const char *msg,...)</div><div class="ttdoc">Nebula's printf replacement.</div><div class="ttdef"><b>Definition</b> debug.cc:209</div></div>
<div class="ttc" id="astruct_util_1_1_string_html_aae44fd420cacbfa974b220218a3732c0"><div class="ttname"><a href="struct_util_1_1_string.html#aae44fd420cacbfa974b220218a3732c0">Util::String::AsCharPtr</a></div><div class="ttdeci">const char * AsCharPtr() const</div><div class="ttdoc">return contents as character pointer</div><div class="ttdef"><b>Definition</b> string.h:540</div></div>
</div><!-- fragment --><p>A client should also check whether the connection is still up by calling the IsConnected() method. If the connection has been dropped for some reason, this method will return false.</p>
<dl class="section note"><dt>Note</dt><dd>TcpServer and TcpClient do not implement an underlying communication protocol which enables them to work with "foreign" clients and servers (for instance, a TcpServer could work with standard web browsers as client, and a TcpClient class could communicate with a standard HTTP server).</dd></dl>
<p>For real world scenarios, an application should implement its own robust communication protocol which at least encodes the length of the payload data. If the payload is bigger then some maximum packet size, data may be sent in several packets, and thus may arrive in several packets at the client. The client should decode the length of the payload from the message header to decide whether the received data represents a complete message, or whether more data needs to be received until message is complete.</p>
<h2><a class="anchor" id="NetByteOrder"></a>
Byte Order Issues</h2>
<p>Servers and clients may run on CPUs with different byte order. If binary data is sent over a network connection, the data must be converted into a "network byte order" which both clients agree on. <a class="el" href="namespace_nebula.html">Nebula</a> offers automatic byte order conversion in the <a class="el" href="class_i_o_1_1_binary_reader.html" title="A friendly interface to read binary data from a stream.">IO::BinaryReader</a> and <a class="el" href="class_i_o_1_1_binary_writer.html" title="A friendly interface for writing binary data to a stream.">IO::BinaryWriter</a> classes. Simply call the following methods before reading from or writing to a network communication stream:</p>
<div class="fragment"><div class="line">binaryReader->SetStreamByteOrder(<a class="code hl_enumvalue" href="class_system_1_1_byte_order.html#a69f674d97704ad498fbe89ff3da88e87a1a573935798e25bb7a0f48a103b201ea">System::ByteOrder::Network</a>);</div>
<div class="line">binaryWriter->SetStreamByteOrder(<a class="code hl_enumvalue" href="class_system_1_1_byte_order.html#a69f674d97704ad498fbe89ff3da88e87a1a573935798e25bb7a0f48a103b201ea">System::ByteOrder::Network</a>);</div>
<div class="ttc" id="aclass_system_1_1_byte_order_html_a69f674d97704ad498fbe89ff3da88e87a1a573935798e25bb7a0f48a103b201ea"><div class="ttname"><a href="class_system_1_1_byte_order.html#a69f674d97704ad498fbe89ff3da88e87a1a573935798e25bb7a0f48a103b201ea">System::ByteOrder::Network</a></div><div class="ttdeci">@ Network</div><div class="ttdef"><b>Definition</b> byteorder.h:40</div></div>
</div><!-- fragment --><h2><a class="anchor" id="NetSocketClass"></a>
The Socket Class</h2>
<p>The <a class="el" href="namespace_net.html">Net</a> subsystem provides a Socket class which wraps the traditional socket functions into a C++ interface. Usually an application doesn't use Socket class directly and instead uses higher level networking classes like TcpServer. But if that's not possible for some reason the Socket class is much more convenient then working directly with socket functions. </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="foundation.html">Foundation Libraries</a></li>
<li class="footer">
Generated on Sat Oct 5 2024 16:49:15 for Nebula. Dark theme by <a href="http://majerle.eu" target="_new">Tilen Majerle</a>. All rights reserved.
</li>
</ul>
</div>
<script src="custom.js"></script>
</body>
</html>