[英]abstract library for easier socket programming under linux
I have to program a server client logic for 2 application, with this conditions: 我必须在以下条件下为2个应用程序编写服务器客户端逻辑:
I was hoping that there is a library that can help me with this to keep my work simple. 我希望有一个可以帮助我简化工作的库。
I want to stress the fact that i have to use only the headers like sys/socket.h
related to socket programming and no other dependecy. 我想强调一个事实,我只需要使用与套接字编程相关的sys/socket.h
类的标头,而不必使用其他依赖项。
Thanks. 谢谢。
Your requirements are a bit inconsistent, because normally a library is a dependency. 您的要求有点不一致,因为通常库是一个依赖项。
Libraries fulfilling your other requirements: Boost.Asio, http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio.html , and ACE (adaptive communication environment), http://www.cs.wustl.edu/~schmidt/ACE.html . 满足您其他要求的库:Boost.Asio, http : //www.boost.org/doc/libs/1_51_0/doc/html/boost_asio.html和ACE(自适应通信环境), http://www.cs。 wustl.edu/~schmidt/ACE.html 。
First, the Berkeley sockets interface really isn't difficult to use, though it's perhaps a little crufty by modern standards. 首先,伯克利套接字接口确实并不难使用,尽管按照现代标准来说可能有点麻烦。 But if you really want something simpler how about text I/O using something like netcat
, avoiding doing socket level programming at all and replacing it with simple process spawning and piping? 但是,如果您真的想要更简单的方法,例如使用netcat
类的文本I / O,完全避免进行套接字级编程,而用简单的进程生成和管道处理代替它? Or make your "deadly simple" protocol a HTTP transaction and use a simple CGI script and curl/wget (or libcurl) on the client? 还是将“非常简单”的协议设为HTTP事务,并在客户端上使用简单的CGI脚本和curl / wget(或libcurl)?
There are lots of simple ways to move data over the network that don't involve crufty C APIs. 有许多简单的方法可以通过网络移动数据,而无需使用笨拙的C API。 Which to choose depends on what it is you're trying to do. 选择哪种取决于您要做什么。
我个人更喜欢poco而不是boost.asio: http ://pocoproject.org/,但这仍然是依赖项!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.