www.digitalmars.com         C & C++   DMDScript  

c++.windows.32-bits - Which header files for using socket(), etc. on windows?

reply Paul M. <paul.morissette ga.com> writes:
I've tried all day and I can't get the WINSOCK2.H file to even be
acceptable.  Do I need special switches or other header files?
I've tried all kinds of combinations.  I've done this stuff under
UNIX and with a library for the TI DSP's.  They were easy.  Any
help greatly appreciated.  Feel free to point me to some example
pages or such.

Paul
May 11 2007
parent Bertel Brander <bertel post4.tele.dk> writes:
Paul M. skrev:
 I've tried all day and I can't get the WINSOCK2.H file to even be
 acceptable.  Do I need special switches or other header files?
 I've tried all kinds of combinations.  I've done this stuff under
 UNIX and with a library for the TI DSP's.  They were easy.  Any
 help greatly appreciated.  Feel free to point me to some example
 pages or such.
 

Try: #include <stdio.h> #include <windows.h> void socket_scs(void) { SOCKET sockfd; if ( (sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { printf("socket error\n"); } /* etc... */ } And compile without -A: dmc -c -r -i. -DWIN32 -D_inline=inline socket_scs.c -A (for ANSI C) and windows headers don't mix well. Rember to call WSAStartup once before trying to open your socket. -- Just another homepage: http://damb.dk But it's mine - Bertel
May 11 2007