RE: [Dev-C++] Get socket with socket function
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: P.D. v. Z. <pa...@my...> - 2003-10-29 23:48:33
|
But your application will be dependent on the Cygwin DLLs, which can be a nuisance. I always prefer native code over emulation, especially when the emulation requires 3rd party libraries. ________________________________ From: dev...@li... [mailto:dev...@li...] On Behalf Of Reid Thompson Sent: Wednesday, October 29, 2003 11:00 PM To: Alain Paschoud; dev...@li... Subject: RE: [Dev-C++] Get socket with socket function If you configure Dev-C++ to use cygwin as the build env you will not have to change your code. reid -----Original Message----- From: Alain Paschoud [mailto:ala...@ge...] Sent: Wednesday, October 29, 2003 3:16 PM To: dev...@li... Subject: [Dev-C++] Get socket with socket function Hi all, 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. 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) : int sockfd; sockfd = socket(AF_INET, SOCK_STREAM, 0); BUT the result of socket function is always -1 (sockfd = -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 : "A -1 is returned if an error occurs" But how can an error happen at this step ? Thank you for any advice. Best regards. |