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
begin 644 socket_scs.c
M#0HC:6YC;'5D92`\0D%315194%,N2#X-"B-I;F-L=61E(#Q724Y$148N2#X-
M"B-I;F-L=61E(#Q724Y33T-+,BY(/ T*#0IV;VED('-O8VME=%]S8W,H=F]I
M9"D-"GL-" E33T-+150 <V]C:V9D.PT*#0H):68 *"`H<V]C:V9D(#T <V]C
M:V5T*$%&7TE.150L(%-/0TM?4U1214%-+"!)4%!23U1/7U1#4"DI(#P ,"D-
M" E[#0H)"7!R:6YT9B B<V]C:V5T(&5R<F]R7&XB*3L-" E]#0H-" DO*B!E
/=&,N+BX *B\-"GT-" T*
`
end
begin 644 make.log
M9&UC("UC("U!("UR("UI+B`M1%=)3C,R("U$7VEN;&EN93UI;FQI;F4 ;6%I
M;BYC#0H-"F1M8R`M8R`M02`M<B`M:2X +41724XS,B`M1%]I;FQI;F4]:6YL
M:6YE('-O8VME=%]S8W,N8PT*455%4EE(04Y$3$52("A,4%9/240 :V5Y8V]N
M=&5X="P 4%9!3$-/3E1%6%0 =F%L7VQI<W0L($173U)$(&YU;5]V86QS+`T*
M("` ("` ("` ("!>#0IC.EQD;5QB:6Y<+BY<:6YC;'5D95QW:6XS,EQ724Y2
M14<N2" X.2D .B!%<G)O<CH ;6ES<VEN9R`G+"< 8F5T=V5E;B!D96-L87)A
M=&EO;B!O9B`G7V-D96-L)R!A;F0 )U%515)92$%.1$Q%4B<-"G1Y<&5D968 
M455%4EE(04Y$3$52($9!4B`J4%%515)92$%.1$Q%4CL-"B` ("` ("` ("` 
M("` ("` ("` ("` ("!>#0IC.EQD;5QB:6Y<+BY<:6YC;'5D95QW:6XS,EQ7
M24Y214<N2" Y,BD .B!%<G)O<CH )STG+"`G.R< ;W( )RPG(&5X<&5C=&5D
M#0H ("` 4%%515)92$%.1$Q%4B!P:5]2,%\Q=F%L.PT*("` ("` ("` ("` 
M("` ("` ("` ("` ("` 7 T*8SI<9&U<8FEN7"XN7&EN8VQU9&5<=VEN,S)<
M5TE.4D5'+D H.34I(#H 17)R;W(Z("<[)R!E>'!E8W1E9"!F;VQL;W=I;F< 
M9&5C;&%R871I;VX ;V8 <W1R=6-T(&UE;6)E< T*("` (%!1545264A!3D1,
M15( <&E?4C!?86QL=F%L<SL-"B` ("` ("` ("` ("` ("` ("` ("` ("` 
M("` (%X-"F,Z7&1M7&)I;EPN+EQI;F-L=61E7'=I;C,R7%=)3E)%1RY(*#DV
M*2`Z($5R<F]R.B`G4%%515)92$%.1$Q%4B< :7, 86QR96%D>2!D969I;F5D
M#0H ("` 4%%515)92$%.1$Q%4B!P:5]2,U\Q=F%L.PT*("` ("` ("` ("` 
M("` ("` ("` ("` ("` 7 T*8SI<9&U<8FEN7"XN7&EN8VQU9&5<=VEN,S)<
M5TE.4D5'+D H.3<I(#H 17)R;W(Z("=0455%4EE(04Y$3$52)R!I<R!A;')E
M861Y(&1E9FEN960-"D9A=&%L(&5R<F]R.B!T;V\ ;6%N>2!E<G)O<G,-"BTM
D+2!E<G)O<FQE=F5L(#$-" T*+2TM(&5R<F]R;&5V96P ,0T*
`
end
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