跨平台网络API [英] Cross platform Networking API

查看:43
本文介绍了跨平台网络API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一个 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.

Boost - 如果您对 C++(模板、元编程等)有相当的熟练程度,那么 Boost 库通常非常好.我不确定 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 工具包很受欢迎,但有一组很棒的线程、事件管理、网络库.IMO,这是迄今为止最容易使用的.

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.

我的个人偏好:APR.

My personal preference: APR.

这篇关于跨平台网络API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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