Simple cross platform TCP IP API?

2020-07-02 09:25发布

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.

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

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.

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

Thanks

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

标签: c++ c api tcp
3条回答
够拽才男人
2楼-- · 2020-07-02 10:11

Perhaps try BOOST Asio

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

Is that light weight enough?

查看更多
神经病院院长
3楼-- · 2020-07-02 10:13

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

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

查看更多
我只想做你的唯一
4楼-- · 2020-07-02 10:13

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

查看更多
登录 后发表回答