macos MAC 中的 TCP 客户端使用 C++
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5451441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TCP client in MAC using C++
提问by Nohsib
I am trying to write a C++ code for the client part of tcp socket to send data to server written in nodejs. I could achieve it on Windows platform, however doing the same on MAC OS is proving tough, any help/code in C++ for the client tcp socket for MAC OS is highly appreciated.
我正在尝试为 tcp 套接字的客户端部分编写 C++ 代码,以将数据发送到用 nodejs 编写的服务器。我可以在 Windows 平台上实现它,但是在 MAC OS 上做同样的事情被证明是困难的,对于 MAC OS 的客户端 tcp 套接字的 C++ 中的任何帮助/代码都受到高度赞赏。
采纳答案by Nohsib
I used the linux/unix libraries for the same and worked like a charm on the MAC...
我使用了相同的 linux/unix 库,并且在 MAC 上工作起来就像一个魅力......
this link has the info :: http://www.linuxhowtos.org/C_C++/socket.htm
回答by Stephen Bailey
Since I don't know what area you are finding trouble with, perhaps the best suggestion is to use a platform independent C++ library so that the only requirement you have for making it work on a Mac and windows is to recompile it.
由于我不知道您在哪个方面遇到问题,因此最好的建议是使用独立于平台的 C++ 库,以便使其在 Mac 和 Windows 上运行的唯一要求是重新编译它。
I am not sure what is out there, but I did find this one : http://dlib.net/
我不确定那里有什么,但我确实找到了这个:http: //dlib.net/