[英]Portable Socket programming in C/C++ possible?
I am thinking of creating a multi-platform portable C++ server-client application. 我正在考虑创建一个多平台的可移植C ++服务器-客户端应用程序。 Is it even possible while using only standard libraries?
仅使用标准库是否有可能? If no, what other libraries are there?
如果没有,还有哪些其他库?
Are there any improvements in this direction in C++11x? C ++ 11x在这个方向上有什么改进吗? Like for threads, now we have std::threads.
就像线程一样,现在我们有了std :: threads。
To make it more clear.. I want something like boost::thread, which provides multiplatform portable multithreading, for networking. 更清楚地说。我想要boost :: thread之类的东西,它提供用于网络的多平台可移植多线程。
And why C++ doesn't have libraries(standard) for such basic things like networking? 为什么C ++没有诸如网络之类的基本内容的库(标准)?
Update : Comparing to Python, which has everything (almost) built in to it... why not in C++? 更新 :与Python相比,Python几乎内置了所有内容……为什么不使用C ++?
There is no standard portable option in C++11. C ++ 11中没有标准的可移植选项。
However the portable boost::asio is one of the best networking API's. 但是,可移植的boost :: asio是最好的网络API之一。 It is based on the proactor pattern which is very efficient.
它基于非常有效的前摄者模式。
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
There is Boost Asio . 有Boost Asio 。 It has existed for "only" a small number of years...long ago we had ACE , but it feels dated now.
它仅存在了很短的几年……很久以前我们有了ACE ,但是现在感觉已经过时了。
There have been many attempts to provide such a cross-platform library for networking over the years. 多年来,已经进行了许多尝试来提供用于网络的这种跨平台库。 The Berkeley socket library comes pretty close (and probably comes with your OS), but there are still platform-specific differences.
Berkeley套接字库非常接近(可能与您的OS一起提供),但是仍然存在特定于平台的差异。 Qt has network socket classes that attempt to be cross-platform within the subset of platforms that Qt normally supports.
Qt具有尝试在Qt通常支持的平台子集中实现跨平台的网络套接字类。 You can probably find lots of others.
您可能会发现很多其他东西。
There is no language standard networking library for C or C++ analogous to std::thread
. 没有类似于
std::thread
C或C ++ 语言标准网络库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.