www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics



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

↑ ↓ ← 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
↑ ↓ → 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