RE: [Dev-C++] Get socket with socket function
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Reid T. <Rei...@at...> - 2003-10-29 21:59:50
|
If you configure Dev-C++ to use cygwin as the build env you will not have to change your code. =20 =20 reid=20 -----Original Message----- From: Alain Paschoud [mailto:ala...@ge...]=20 Sent: Wednesday, October 29, 2003 3:16 PM To: dev...@li... Subject: [Dev-C++] Get socket with socket function =09 =09 Hi all,=20 I managed to compile a simple program that should just wait for an icoming connection on a inet type socket. I did it under Mac OS X and Linux, and I want to do the same thing with dev-cpp.=20 Due to explanation give on this mailing list (thanks for your quick and usefull answers), I change the code to use winsock.h instead of sys/socket.h. I added the necessary library and DLLs. The program starts correctly and get it the function to create the socket file descriptor (it is very simple) :=20 int sockfd;=20 sockfd =3D socket(AF_INET, SOCK_STREAM, 0);=20 BUT the result of socket function is always -1 (sockfd =3D -1). What could be the cause of that ? I found a similar example of socket creation for windows, I did exactly the same as in the example. The only thing I have found in "socket" man page is :=20 "A -1 is returned if an error occurs"=20 But how can an error happen at this step ?=20 Thank you for any advice.=20 Best regards. |