对于C简单的异步多线程的HTTP请求++库 [英] Simple Asynchronous Multi-Threaded HTTP request library for C++

查看:365
本文介绍了对于C简单的异步多线程的HTTP请求++库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会快速和诚实:我目前正在写一个在线游戏的客户端/服务器。因为我穷,有限的资源,我将使用一个PHP后端测试服务器的裸基础知识,与最终目标是重建在C ++服务器端的。

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++.

我在找一个C的Windows(XP和Vista preferably)++库,可以让我用一个有限数量的线程,一心致力于每一件网络问题。举个例子,我想用一个线程的球员的位置信息报告给服务器(和接收有关其他玩家位置信息的反应),但我希望有一个不同的线程后台下载在该地区的3D图稿/播放器和一个不同的线程为内置在聊天系统等,这些都需要相当彼此独立

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.

我知道我想要什么的的有图书馆,我已经得到了设计有点想通了,我只是觉得有点傻重新发明轮子,因为我知道,一个好的图书馆为此确切的目的可能已经存在。那么,你有什么建议?我需要能够将数据发送到服务器,以及接受响应。理想情况下,请求需要触发一个事件的完成时(这样我就可以立即获取数据,并用它做什么),我需要能够同时处理多个交易。 HTTP是一个不错的奖金,但如果需要,我可以处理HTTP协议自己,尤其是考虑到我计划在长期内删除它。

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.

谢谢!

推荐答案

Boost.Asio的

ASIO简单的web服务器的例子。

ASIO has simple web server examples.

Boost.Thread

这篇关于对于C简单的异步多线程的HTTP请求++库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆