3

I'll be quick and honest: I'm currently trying to write a client/server for an online game. Since I'm poor and limited on resources, I'll be testing the bare basics of the server using a PHP backend, with the eventual goal being to rebuild the server end in C++.

I'm looking for a C++ library for Windows (XP and Vista preferably) that will let me use a finite number of threads, one dedicated to each piece of the networking problem. As an example, I want to use a thread to report the positional information of the player to the server (and to receive responses about positional information of the other players) but I want a different thread to background download in the 3D artwork for the area/players, and a different thread for the built in chat system, etc. These all need to be fairly independent of one another.

I know what I want to do with the library, I've got the design bit figured out, I just feel a bit silly re-inventing the wheel, since I know that a good library for this exact purpose probably already exists. So, what are your suggestions? I need to be able to send data to a server, and accept responses. Ideally, the request needs to trigger an Event when its done (so I can immediately grab the data and do something with it) and I need to be able to handle multiple transactions simultaneously. HTTP is a nice bonus, but I can handle HTTP protocol myself if necessary, especially considering that I plan on dropping it in the long run.

Thanks!

4

5 回答 5

4

Boost.Asio

ASIO 有简单的 Web 服务器示例。

Boost.Thread

于 2008-12-05T04:35:28.827 回答
2

你可以试试POCO库。它有一个多线程 TCP 服务器和一个 HTTP 服务器。

于 2008-12-05T05:12:52.103 回答
1

Check out the Boost libraries, in particular, Boost Threads.

于 2008-12-05T04:31:33.310 回答
1

你可以试试我的CSocksetServer类。它可以在单独的线程中处理许多连接,并为您提供许多不同的事件。虽然它没有原生 HTTP 功能,但我已经用它构建了 Web 服务器。

于 2009-02-03T17:48:18.880 回答
-2

您应该只使用带有多手柄的cUrl。它比你设计的任何东西都更适合做你想做的事。

于 2009-06-26T22:04:24.037 回答