将 UNIX 套接字移植到 Windows,无需使用 winsock。真的吗?
我有一些使用 UNIX 套接字的代码。但我需要为winodws编译它(在mac os x上使用mingw32),但我不想使用winsock,因为我担心兼容性!有没有办法在 Windows 上使用 UNIX 套接字?
I have some code that using UNIX sockets. But I need to compile it for winodws(using mingw32 on mac os x) but I don't want to use winsock because I'm worried about compatibility! Is there is a way to use UNIX sockets on windows?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您坚持使用 Winsock 提供的 BSD API,那么您不会遇到那么多问题。少量启动和关闭代码将是 Windows 特定的,但大多数套接字代码将是跨平台的。
If you stick to the BSD API that Winsock provides then you wont have that many problems. A small amount of start up and shutdown code will be Windows specific but most of the socket code will be cross platform.
我建议查看 cygwin (http://www.cygwin.com/),他们尽一切努力实现兼容。但是,我不知道如何在 Mac OSX 上针对该环境进行交叉编译。
I'd suggest looking into cygwin (http://www.cygwin.com/), they make every effort to be compatible. However, I have no idea how you would cross-compile for that environment on Mac OSX.