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 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507
|
<!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"/>
<title>enet: ENet host functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.1 -->
<div class="navigation" id="top">
<div class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<h1>ENet host functions</h1> </div>
</div>
<div class="contents">
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga444b74e7b70d97e2abd02328419be3f4">enet_host_compress_with_range_coder</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the packet compressor the host should use to the default range coder. <a href="#ga444b74e7b70d97e2abd02328419be3f4"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga5567a95d7a45521dc9cba93a9066c940">enet_host_create</a> (const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> *address, size_t peerCount, size_t channelLimit, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> incomingBandwidth, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> outgoingBandwidth)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a host for communicating to peers. <a href="#ga5567a95d7a45521dc9cba93a9066c940"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gacec1e9a0b528c1f9ce30544d2d5b5b79">enet_host_destroy</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destroys the host and all resources associated with it. <a href="#gacec1e9a0b528c1f9ce30544d2d5b5b79"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="struct__ENetPeer.html">ENetPeer</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga23b3ac206326b84f42fa91673f12fca9">enet_host_connect</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> *address, size_t channelCount, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> data)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Initiates a connection to a foreign host. <a href="#ga23b3ac206326b84f42fa91673f12fca9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga5190a63f78eb0c15bd96cda44bf423c6">enet_host_broadcast</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="types_8h.html#a34ce80c65abc6389fe0121a83d757f07">enet_uint8</a> channelID, <a class="el" href="struct__ENetPacket.html">ENetPacket</a> *packet)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Queues a packet to be sent to all peers associated with the host. <a href="#ga5190a63f78eb0c15bd96cda44bf423c6"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gae9e23efdfc718dedaa349891dddf529b">enet_host_compress</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, const <a class="el" href="struct__ENetCompressor.html">ENetCompressor</a> *compressor)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the packet compressor the host should use to compress and decompress packets. <a href="#gae9e23efdfc718dedaa349891dddf529b"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gaa3c04d1a1a41f46a2db274f29a8d0ffd">enet_host_channel_limit</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, size_t channelLimit)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Limits the maximum allowed channels of future incoming connections. <a href="#gaa3c04d1a1a41f46a2db274f29a8d0ffd"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga83c5fa02a3ba6ab829856302e54929fe">enet_host_bandwidth_limit</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> incomingBandwidth, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> outgoingBandwidth)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Adjusts the bandwidth limits of a host. <a href="#ga83c5fa02a3ba6ab829856302e54929fe"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gac76acd47fd07c27e5b85ecb63b192dd1"></a><!-- doxytag: member="host::enet_host_bandwidth_throttle" ref="gac76acd47fd07c27e5b85ecb63b192dd1" args="(ENetHost *host)" -->
void </td><td class="memItemRight" valign="bottom"><b>enet_host_bandwidth_throttle</b> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gac8f53bcdbd540043f87e7d59048559fa">enet_host_flush</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sends any queued packets on the host specified to its designated peers. <a href="#gac8f53bcdbd540043f87e7d59048559fa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#gabf2383e4a5ed864c56a50dc67b901fe9">enet_host_check_events</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="struct__ENetEvent.html">ENetEvent</a> *event)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Checks for any queued events on the host and dispatches one if available. <a href="#gabf2383e4a5ed864c56a50dc67b901fe9"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="group__host.html#ga6ba501b3ee576e5578c8e6d1694ebd49">enet_host_service</a> (<a class="el" href="struct__ENetHost.html">ENetHost</a> *host, <a class="el" href="struct__ENetEvent.html">ENetEvent</a> *event, <a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> timeout)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Waits for events on the host specified and shuttles packets between the host and its peers. <a href="#ga6ba501b3ee576e5578c8e6d1694ebd49"></a><br/></td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga83c5fa02a3ba6ab829856302e54929fe"></a><!-- doxytag: member="host.c::enet_host_bandwidth_limit" ref="ga83c5fa02a3ba6ab829856302e54929fe" args="(ENetHost *host, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_bandwidth_limit </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>incomingBandwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>outgoingBandwidth</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to adjust </td></tr>
<tr><td valign="top"></td><td valign="top"><em>incomingBandwidth</em> </td><td>new incoming bandwidth </td></tr>
<tr><td valign="top"></td><td valign="top"><em>outgoingBandwidth</em> </td><td>new outgoing bandwidth </td></tr>
</table>
</dd>
</dl>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>the incoming and outgoing bandwidth parameters are identical in function to those specified in <a class="el" href="group__host.html#ga5567a95d7a45521dc9cba93a9066c940" title="Creates a host for communicating to peers.">enet_host_create()</a>. </dd></dl>
</div>
</div>
<a class="anchor" id="ga5190a63f78eb0c15bd96cda44bf423c6"></a><!-- doxytag: member="host.c::enet_host_broadcast" ref="ga5190a63f78eb0c15bd96cda44bf423c6" args="(ENetHost *host, enet_uint8 channelID, ENetPacket *packet)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_broadcast </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a34ce80c65abc6389fe0121a83d757f07">enet_uint8</a> </td>
<td class="paramname"> <em>channelID</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct__ENetPacket.html">ENetPacket</a> * </td>
<td class="paramname"> <em>packet</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host on which to broadcast the packet </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelID</em> </td><td>channel on which to broadcast </td></tr>
<tr><td valign="top"></td><td valign="top"><em>packet</em> </td><td>packet to broadcast </td></tr>
</table>
</dd>
</dl>
<p>References <a class="el" href="group__Packet.html#gab58895376ee4ade8f4e13761a44ba263">enet_packet_destroy()</a>, and <a class="el" href="group__peer.html#gaf082a0ae58d9c435bed75c7325cf7290">enet_peer_send()</a>.</p>
</div>
</div>
<a class="anchor" id="gaa3c04d1a1a41f46a2db274f29a8d0ffd"></a><!-- doxytag: member="host.c::enet_host_channel_limit" ref="gaa3c04d1a1a41f46a2db274f29a8d0ffd" args="(ENetHost *host, size_t channelLimit)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_channel_limit </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>channelLimit</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to limit </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelLimit</em> </td><td>the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gabf2383e4a5ed864c56a50dc67b901fe9"></a><!-- doxytag: member="protocol.c::enet_host_check_events" ref="gabf2383e4a5ed864c56a50dc67b901fe9" args="(ENetHost *host, ENetEvent *event)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int enet_host_check_events </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct__ENetEvent.html">ENetEvent</a> * </td>
<td class="paramname"> <em>event</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to check for events </td></tr>
<tr><td valign="top"></td><td valign="top"><em>event</em> </td><td>an event structure where event details will be placed if available </td></tr>
</table>
</dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>></em> </td><td>0 if an event was dispatched </td></tr>
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>if no events are available </td></tr>
<tr><td valign="top"></td><td valign="top"><em><</em> </td><td>0 on failure </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gae9e23efdfc718dedaa349891dddf529b"></a><!-- doxytag: member="host.c::enet_host_compress" ref="gae9e23efdfc718dedaa349891dddf529b" args="(ENetHost *host, const ENetCompressor *compressor)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_compress </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="struct__ENetCompressor.html">ENetCompressor</a> * </td>
<td class="paramname"> <em>compressor</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to enable or disable compression for </td></tr>
<tr><td valign="top"></td><td valign="top"><em>compressor</em> </td><td>callbacks for for the packet compressor; if NULL, then compression is disabled </td></tr>
</table>
</dd>
</dl>
<p>References <a class="el" href="struct__ENetCompressor.html#a2818b3832d2809386ff7659d057acdc6">_ENetCompressor::context</a>.</p>
<p>Referenced by <a class="el" href="group__host.html#ga444b74e7b70d97e2abd02328419be3f4">enet_host_compress_with_range_coder()</a>.</p>
</div>
</div>
<a class="anchor" id="ga444b74e7b70d97e2abd02328419be3f4"></a><!-- doxytag: member="compress.c::enet_host_compress_with_range_coder" ref="ga444b74e7b70d97e2abd02328419be3f4" args="(ENetHost *host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int enet_host_compress_with_range_coder </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to enable the range coder for </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>0 on success, < 0 on failure </dd></dl>
<p>References <a class="el" href="struct__ENetCompressor.html#a2818b3832d2809386ff7659d057acdc6">_ENetCompressor::context</a>, and <a class="el" href="group__host.html#gae9e23efdfc718dedaa349891dddf529b">enet_host_compress()</a>.</p>
</div>
</div>
<a class="anchor" id="ga23b3ac206326b84f42fa91673f12fca9"></a><!-- doxytag: member="host.c::enet_host_connect" ref="ga23b3ac206326b84f42fa91673f12fca9" args="(ENetHost *host, const ENetAddress *address, size_t channelCount, enet_uint32 data)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct__ENetPeer.html">ENetPeer</a>* enet_host_connect </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> * </td>
<td class="paramname"> <em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>channelCount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>data</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host seeking the connection </td></tr>
<tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>destination for the connection </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelCount</em> </td><td>number of channels to allocate </td></tr>
<tr><td valign="top"></td><td valign="top"><em>data</em> </td><td>user data supplied to the receiving host </td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>a peer representing the foreign host on success, NULL on failure </dd></dl>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>The peer returned will have not completed the connection until <a class="el" href="group__host.html#ga6ba501b3ee576e5578c8e6d1694ebd49" title="Waits for events on the host specified and shuttles packets between the host and its peers...">enet_host_service()</a> notifies of an ENET_EVENT_TYPE_CONNECT event for the peer. </dd></dl>
<p>References <a class="el" href="unix_8h.html#a4ede48cf4612d407ac6b6f064e3117bc">ENET_HOST_TO_NET_16</a>, and <a class="el" href="unix_8h.html#a7bbe3d7e47fd45dda29c0e4a94abe131">ENET_HOST_TO_NET_32</a>.</p>
</div>
</div>
<a class="anchor" id="ga5567a95d7a45521dc9cba93a9066c940"></a><!-- doxytag: member="host.c::enet_host_create" ref="ga5567a95d7a45521dc9cba93a9066c940" args="(const ENetAddress *address, size_t peerCount, size_t channelLimit, enet_uint32 incomingBandwidth, enet_uint32 outgoingBandwidth)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="struct__ENetHost.html">ENetHost</a>* enet_host_create </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="struct__ENetAddress.html">ENetAddress</a> * </td>
<td class="paramname"> <em>address</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>peerCount</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"> <em>channelLimit</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>incomingBandwidth</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>outgoingBandwidth</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>address</em> </td><td>the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>peerCount</em> </td><td>the maximum number of peers that should be allocated for the host. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>channelLimit</em> </td><td>the maximum number of channels allowed; if 0, then this is equivalent to ENET_PROTOCOL_MAXIMUM_CHANNEL_COUNT </td></tr>
<tr><td valign="top"></td><td valign="top"><em>incomingBandwidth</em> </td><td>downstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>outgoingBandwidth</em> </td><td>upstream bandwidth of the host in bytes/second; if 0, ENet will assume unlimited bandwidth.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the host on success and NULL on failure</dd></dl>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>ENet will strategically drop packets on specific sides of a connection between hosts to ensure the host's bandwidth is not overwhelmed. The bandwidth parameters also determine the window size of a connection which limits the amount of reliable packets that may be in transit at any given time. </dd></dl>
<p>References <a class="el" href="group__peer.html#ga9444dfff9574a7d21dbbdd34385a7d4d">enet_peer_reset()</a>.</p>
</div>
</div>
<a class="anchor" id="gacec1e9a0b528c1f9ce30544d2d5b5b79"></a><!-- doxytag: member="host.c::enet_host_destroy" ref="gacec1e9a0b528c1f9ce30544d2d5b5b79" args="(ENetHost *host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_destroy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>pointer to the host to destroy </td></tr>
</table>
</dd>
</dl>
<p>References <a class="el" href="group__peer.html#ga9444dfff9574a7d21dbbdd34385a7d4d">enet_peer_reset()</a>.</p>
</div>
</div>
<a class="anchor" id="gac8f53bcdbd540043f87e7d59048559fa"></a><!-- doxytag: member="protocol.c::enet_host_flush" ref="gac8f53bcdbd540043f87e7d59048559fa" args="(ENetHost *host)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void enet_host_flush </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em></td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to flush </td></tr>
</table>
</dd>
</dl>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>this function need only be used in circumstances where one wishes to send queued packets earlier than in a call to <a class="el" href="group__host.html#ga6ba501b3ee576e5578c8e6d1694ebd49" title="Waits for events on the host specified and shuttles packets between the host and its peers...">enet_host_service()</a>. </dd></dl>
<p>References <a class="el" href="enet_8h.html#a3d60275f78985d9aaba12c2fad13c37f">enet_time_get()</a>.</p>
<p>Referenced by <a class="el" href="group__peer.html#ga0e807704b6ecace5004c2cdcfbf813c2">enet_peer_disconnect()</a>, and <a class="el" href="group__peer.html#ga636cc45f52461b567d6daffe4ab8f4e9">enet_peer_disconnect_now()</a>.</p>
</div>
</div>
<a class="anchor" id="ga6ba501b3ee576e5578c8e6d1694ebd49"></a><!-- doxytag: member="protocol.c::enet_host_service" ref="ga6ba501b3ee576e5578c8e6d1694ebd49" args="(ENetHost *host, ENetEvent *event, enet_uint32 timeout)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int enet_host_service </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct__ENetHost.html">ENetHost</a> * </td>
<td class="paramname"> <em>host</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct__ENetEvent.html">ENetEvent</a> * </td>
<td class="paramname"> <em>event</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="types_8h.html#a5273659ca3c664b8550452732e9e4ae3">enet_uint32</a> </td>
<td class="paramname"> <em>timeout</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<dl><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>host</em> </td><td>host to service </td></tr>
<tr><td valign="top"></td><td valign="top"><em>event</em> </td><td>an event structure where event details will be placed if one occurs if event == NULL then no events will be delivered </td></tr>
<tr><td valign="top"></td><td valign="top"><em>timeout</em> </td><td>number of milliseconds that ENet should wait for events </td></tr>
</table>
</dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>></em> </td><td>0 if an event occurred within the specified time limit </td></tr>
<tr><td valign="top"></td><td valign="top"><em>0</em> </td><td>if no event occurred </td></tr>
<tr><td valign="top"></td><td valign="top"><em><</em> </td><td>0 on failure </td></tr>
</table>
</dd>
</dl>
<dl class="remark"><dt><b>Remarks:</b></dt><dd>enet_host_service should be called fairly regularly for adequate performance </dd></dl>
<p>References <a class="el" href="enet_8h.html#a3d60275f78985d9aaba12c2fad13c37f">enet_time_get()</a>.</p>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>Generated on Tue May 31 2011 03:26:47 for enet by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>
|