简单的跨平台TCP IP API?

时间:2022-05-17 02:27:31

I'm not looking to use something big like QT or wxWidgets' APIs. I just want simple sockets that will work on Android, iOS, Windows, Mac, Linux.

我不打算使用QT或wxWidgets的API之类的东西。我只想要能在Android,iOS,Windows,Mac,Linux上运行的简单套接字。

I'm making an event driven card game so TCP would be best.

我正在制作一个事件驱动的纸牌游戏,所以TCP最好。

Essentially, I just want to connect and authenticate clients. After that I just need to be able to send them messages. I was going to use reliable UDP but TCP seems more appropriate.

基本上,我只想连接和验证客户端。之后我只需要能够发送消息。我打算使用可靠的UDP,但TCP似乎更合适。

If anyone also has basic tutorials for something like a tcp chat application I'd appreciate it.

如果有人也有类似tcp聊天应用程序的基本教程,我会很感激。

Thanks

谢谢

I just want to be able to use, send(), recv, etc without worrying about WINSOCK or POSIX,

我只是想能够使用,发送(),recv等,而不用担心WINSOCK或POSIX,

3 个解决方案

#1


6  

Perhaps try BOOST Asio

也许试试BOOST Asio

http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio.html

http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio.html

Is that light weight enough?

那重量轻吗?

#2


0  

I've made a really simple, lightweight wrapper around the BSD Sockets API. It does TCP/IP communication only, using a server and a client (a server can optionally accept multiple client connections).

我在BSD套接字API周围制作了一个非常简单,轻量级的包装器。它仅使用服务器和客户端进行TCP / IP通信(服务器可以选择接受多个客户端连接)。

You can find it here: (don't mind the Objective-C classes, use tcpconnect.h and tcpconnect.c only): http://github.com/H2CO3/TCPHelper

你可以在这里找到它:(不要介意Objective-C类,只使用tcpconnect.h和tcpconnect.c):http://github.com/H2CO3/TCPHelper

#3


0  

Perharps Boost.Asio (http://boost.org) or this one http://libunicomm.org based on Asio could be useful for you.

Perharps Boost.Asio(http://boost.org)或基于Asio的这个http://libunicomm.org可能对您有用。

#1


6  

Perhaps try BOOST Asio

也许试试BOOST Asio

http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio.html

http://www.boost.org/doc/libs/1_49_0/doc/html/boost_asio.html

Is that light weight enough?

那重量轻吗?

#2


0  

I've made a really simple, lightweight wrapper around the BSD Sockets API. It does TCP/IP communication only, using a server and a client (a server can optionally accept multiple client connections).

我在BSD套接字API周围制作了一个非常简单,轻量级的包装器。它仅使用服务器和客户端进行TCP / IP通信(服务器可以选择接受多个客户端连接)。

You can find it here: (don't mind the Objective-C classes, use tcpconnect.h and tcpconnect.c only): http://github.com/H2CO3/TCPHelper

你可以在这里找到它:(不要介意Objective-C类,只使用tcpconnect.h和tcpconnect.c):http://github.com/H2CO3/TCPHelper

#3


0  

Perharps Boost.Asio (http://boost.org) or this one http://libunicomm.org based on Asio could be useful for you.

Perharps Boost.Asio(http://boost.org)或基于Asio的这个http://libunicomm.org可能对您有用。