UDP开发包 ENet
<p>ENet 是一个易用的、可移植的 UDP 网络开发包,主要功能包括连接管理、可靠的按顺序的多通道包传输机制、包分解和重新打包、避免堵塞机制等。</p> <p>下面是一个用 ENet 创建的服务器端代码示例:</p> <pre class="brush:cpp; toolbar: true; auto-links: false;"> ENetAddress address; ENetHost * server; /* Bind the server to the default localhost. */ /* A specific host address can be specified by */ /* enet_address_set_host (& address, "x.x.x.x"); */ address.host = ENET_HOST_ANY; /* Bind the server to port 1234. */ address.port = 1234; server = enet_host_create (& address /* the address to bind the server host to */, 32 /* allow up to 32 clients and/or outgoing connections */, 0 /* assume any amount of incoming bandwidth */, 0 /* assume any amount of outgoing bandwidth */); if (server == NULL) { fprintf (stderr, "An error occurred while trying to create an ENet server host.\n"); exit (EXIT_FAILURE); } ... ... ... enet_host_destroy(server);</pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1325834185203" target="_blank">http://www.open-open.com/lib/view/home/1325834185203</a></p> <p></p>
本文由用户 fmms 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!