简体   繁体   English

Windows中的cygwin套接字

[英]Sockets in windows with cygwin

I am facing a problem working with cygwin and sockets under windows. 我在Windows下使用cygwin和套接字时遇到问题。 The code is working normaly in Ubuntu but when I am running it under windows, the socket will not open (error 10093) because no WSAStartup call was made. 该代码在Ubuntu中正常工作,但是当我在Windows下运行该代码时,套接字不会打开(错误10093),因为没有进行WSAStartup调用。 But when I include winsock.h for WSAStartup i cant even compile because of an conflicting declaration of int select(int, _types_fd_set*, _types_fd_set*, _types_fd_set*, PTIMEVAL) in winsock and unistd . 但是当我为WSAStartup包含winsock.h时,我甚至无法编译,因为winsock和unistd中的int select(int, _types_fd_set*, _types_fd_set*, _types_fd_set*, PTIMEVAL)声明相互冲突。

however does anyone know a way to get sockets run with cygwin??? 但是有人知道用cygwin运行套接字的方法吗???

thanks 谢谢

Don't mess up cygwin with windows libs an everything works fine! 不要用Windows库弄坏Cygwin,一切正常! Since I am not including any windows lib, the UNIX sockets work fine. 由于我不包括任何Windows库,因此UNIX套接字可以正常工作。

Thanks to user4581301. 感谢user4581301。

将_winsock_deprecated_no_warnings放入定义中并#include <winsock2.h>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM