问题描述
我不知道是否有一个API来完成联网,将在Windows,Mac和Linux工作。我想作一张卡片游戏,2人可通过TCP连接播放。
I was wondering if there was an API to do networking that would work on Windows, Mac and Linux. I would like to make a card game that 2 people can play through a tcp connection.
感谢
推荐答案
有这几个选项,有些比别人更容易使用:
There are a few options for this, some easier to use than others:
-
APR(Apache可移植运行时) - 很受欢迎。很容易使用。包括很多方便的网络编程的附加功能(线程,互斥等)
APR (Apache Portable Runtime) - Very popular. Quite easy to use. Includes lots of additional features handy for network programming (threads, mutexes, etc.)
ACE - 嵌入式领域的青睐。就个人而言,我觉得这是很复杂的API,而不是非常简单易用。
ACE - Popular among the embedded space. Personally, I found it quite a complicated API, and not very straightforward to use.
升压 - 如果你有C ++(模板元编程等)复杂的一个体面的水平,那么Boost库一般都非常好。我不知道该升压异步联网图书馆如何流行的是在现实世界中。
Boost - If you have a decent level of sophistication with C++ (templates, metaprogramming, etc.), then Boost libraries are generally very good. I'm not sure how popular the Boost asynchronous networking libraries are in the real world.
QT - 大众作为一个UI工具包,但有一个很大的线程组,事件管理,网络库。海事组织,这是迄今为止最容易使用的。
QT - Popular as a UI toolkit, but has a great set of threading, event management, networking libraries. IMO, this is by far the easiest to use.
这从使用Berkeley套接字库走就走很重要,因为跨操作系统的实现差异很大,你会失去的时间公平位调谐他们为你端口跨操作系统软件。
It's important to stay away from using the berkeley sockets library, as the implementations across operating systems vary wildly, and you'll lose a fair bit of time to tuning them as you port your software across OSs.
我个人的preference:APR
My personal preference: APR.
这篇关于跨平台联网API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!