便携式轻量级C ++套接字包装器 [英] Portable lightweight C++ sockets wrapper

查看:72
本文介绍了便携式轻量级C ++套接字包装器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的以为这会更容易找到...

I really thought this would be easier to find...

我需要一个便携式c ++套接字包装器.我打算将其用于Windows Server应用程序和将在运行ulinux(或类似功能)的嵌入式设备上运行的客户端.我会使用Boost,但我需要它轻巧并且易于添加到嵌入式设备项目中.

I need a portable c++ sockets wrapper. I'm planning to use it for a windows server application and a client that will be running on a embedded device running ulinux (or something similar). I would use Boost but I need it to be lightweight and easy to add to the embedded device project.

我也希望它是一个高级"包装器...因此它启动了一个后台线程来读取数据并通过回调通知...

Also I would like it to be a "higher level" wrapper... so it starts a background thread to read data and informs be over a callback...

有什么想法吗?

推荐答案

只需学习直接使用套接字API.然后,您可以轻松地自己包装它. 并不难,您可以开始使用 Beej的出色指南.正如Beej所说:

Just learn to use the socket API directly. You can then easily wrap it yourself. It's not that hard, and you can get started with Beej's excellent guide. As Beej says:

套接字API,尽管由 伯克利人,已被移植到许多国家 许多平台,包括Unix,Linux, 甚至Windows.

The sockets API, though started by the Berkeley folk, has been ported to many many platforms, including Unix, Linux, and even Windows.

在他的指南中,他详细介绍了在Windows和* nix系统中获得相同API所需做的很小的事情.

In his guide he details the very small addition you need to do to get the same API in Windows and *nix systems.

一旦学到了,如果愿意的话,可以自己把它包起来.然后,您可以精确控制所需的轻量级".

Once you've learned, wrap it yourself if you're so inclined. Then you can control exactly how "lightweight" you want it.

这篇关于便携式轻量级C ++套接字包装器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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