用C,任何跨平台套接字库(Linux的Windows和AMP)的知道吗? [英] Know of any cross platform socket library (windows & Linux) in C?

查看:246
本文介绍了用C,任何跨平台套接字库(Linux的Windows和AMP)的知道吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望做socket通信(倾听,接受,连接,recv的,发送断开连接)在Linux和Windows。我的项目是在C,所以,除非有人能想到的一个办法,我来整合C ++库为C项目库将不得不在C也是如此。

I am looking to do socket communications (listen, accept, connect, recv, send, disconnect) in both linux and windows. My project is in C, so unless someone can think of a way for me to integrate C++ libraries into a C project the library will have to be in C as well.

最后,我想图书馆有IPv6的支持和非阻塞模式,但是,这些东西都不是必需的。

Ultimately, I would like the library to have ipv6 support and non-blocking mode, however, these things are not essential.

有谁知道任何库/跨平台的例子code的?甚至只是大code段将有所帮助。到目前为止,我已经找到已经在C ++中,为数不多的插座库

Does anyone know of any libraries/cross-platform example code? Even just large code snippets would help. So far the few socket libraries I have found have been in C++.

推荐答案

断手,我能想到的四个库:

Off-hand, I can think of four libraries:

  • GLib Channels from the GLib framework can abstract socket usage, but you'll need platform-specific code for socket creation.

libuv 是对的Node.js和手柄,除其他事项外,插座和异步IO的平台抽象层。

libuv is a platform abstraction layer for node.js and handles, among other things, sockets and async IO.

借助 Apache的便携式运行还包含的网络程序的。

借助网景便携式运行做的socket操纵为好。

这篇关于用C,任何跨平台套接字库(Linux的Windows和AMP)的知道吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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