D - sockets in linux
- Carlos Santander B. (173/173) May 21 2003 I'm sure this isn't complete, but it's a start anyway. It compiles and I
-
Carlos Santander B.
(30/30)
May 24 2003
"Carlos Santander B."
escribiσ en el mensaje
I'm sure this isn't complete, but it's a start anyway. It compiles and I tried it a bit, but the weirdest thing happens: I wrote 2 simple programs: the client reads a string from stdin, sends it to the server, the server outputs to stdout, sends it back to the client, the client outputs to stdout. The client creates the socket properly: I checked. However, for some reason, the server doesn't seem to go beyond the socket() function (if I could debug it, it could be better). Anyway, give it a try, correct it, etc., etc. ------------------------- Carlos Santander --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.483 / Virus Database: 279 - Release Date: 2003-05-19 begin 666 Socket.d M;6]D=6QE(%-O8VME=#L*"B\O(%1O($0 8GD 0V%R;&]S(%-A;G1A;F1E< H* M86QI87, =6EN="!I;E]A9&1R7W0["F%L:6%S('5S:&]R="!S85]F86UI;'E? M=#L*86QI87, =7-H;W)T(&EN7W!O<G1?=#L*86QI87, :6YT('-O8VML96Y? M=#L M"4E.041$4E]"4D]!1$-!4U0)/0DP>&9F9F9F9F9F+ H)24Y!1$127TY/3D4) M/0DP>&9F9F9F9F9F.PH*+RH 4')O=&]C;VP 9F%M:6QI97,N(" J+PIC;VYS M="!S85]F86UI;'E?="!01E]53E-014,)/0DP"2\J(%5N<W!E8VEF:65D+B M*B\*"2Q01E],3T-!3 D]"3$)+RH 3&]C86P =&\ :&]S=" H<&EP97, 86YD M(&9I;&4M9&]M86EN*2X ("HO" DL4$9?54Y)6 D]"5!&7TQ/0T%,("\J($]L M3T-!3" O*B!!;F]T:&5R(&YO;BUS=&%N9&%R9"!N86UE(&9O<B!01E],3T-! M3"X ("HO" DL4$9?24Y%5 D]"3()+RH 25 <')O=&]C;VP 9F%M:6QY+B M"2Q01E])4% )/0DT"2\J($YO=F5L;"!);G1E<FYE="!0<F]T;V-O;"X ("HO M" DL4$9?05!03$5404Q+"3T)-0DO*B!!<'!L971A;&L 1$10+B *B\*"2Q0 M1E].15123TT)/0DV"2\J($%M871E=7( <F%D:6\ 3F5T4D]-+B *B\*"2Q0 M1E]"4DE$1T4)/0DW"2\J($UU;'1I<')O=&]C;VP 8G)I9&=E+B *B\*"2Q0 M1E]!5$U05D,)/0DX"2\J($%432!05D-S+B *B\*"2Q01E]8,C4)/0DY"2\J M(%)E<V5R=F5D(&9O<B!8+C(U('!R;VIE8W0N(" J+PH)+%!&7TE.150V"3T) M,3 )+RH 25 =F5R<VEO;B V+B *B\*"2Q01E]23U-%"3T),3$)+RH 06UA M4F5S97)V960 9F]R($1%0VYE="!P<F]J96-T+B *B\*"2Q01E].151"155) M+%!&7U-%0U522519"3T),30)+RH 4V5C=7)I='D 8V%L;&)A8VL <'-E=61O M($%&+B *B\*"2Q01E]+15D)/0DQ-0DO*B!01E]+15D :V5Y(&UA;F%G96UE M;G0 05!)+B *B\*"2Q01E].151,24Y+"3T),38*"2Q01E]23U5410D]"5!& M7TY%5$Q)3DL +RH 06QI87, =&\ 96UU;&%T92 T+C1"4T0N(" J+PH)+%!& M7U!!0TM%5 D]"3$W"2\J(%!A8VME="!F86UI;'DN(" J+PH)+%!&7T%32 D] M"3$X"2\J($%S:"X ("HO" DL4$9?14-/3D54"3T),3D)+RH 06-O<FX 16-O M4$9?4TY!"3T),C()+RH 3&EN=7 4TY!(%!R;VIE8W0 *B\*"2Q01E])4D1! M"3T),C,)+RH 25)$02!S;V-K971S+B *B\*"2Q01E]04%!/6 D]"3(T"2\J M(%!04&]8('-O8VME=',N(" J+PH)+%!&7U=!3E!)4$4)/0DR-0DO*B!786YP M:7!E($%022!S;V-K971S+B *B\*"2Q01E]"3%5%5$]/5$ )/0DS,0DO*B!" M;'5E=&]O=& <V]C:V5T<RX ("HO" DL4$9?34%8"3T),S()+RH 1F]R(&YO M=RXN(" J+PH["B\J($%D9')E<W, 9F%M:6QI97,N(" J+PIC;VYS="!S85]F M86UI;'E?= E!1E]53E-014,)/0E01E]53E-014,L" E!1E],3T-!3 D]"5!& M7TQ/0T%,+ H)049?54Y)6 D]"5!&7U5.25 L" E!1E]&24Q%"3T)4$9?1DE, M12P*"4%&7TE.150)/0E01E])3D54+ H)049?05 R-0D]"5!&7T%8,C4L" E! M1E])4% )/0E01E])4% L" E!1E]!4%!,151!3$L)/0E01E]!4%!,151!3$LL M" E!1E].15123TT)/0E01E].15123TTL" E!1E]"4DE$1T4)/0E01E]"4DE$ M1T4L" E!1E]!5$U05D,)/0E01E]!5$U05D,L" E!1E]8,C4)/0E01E]8,C4L M" E!1E])3D54- D]"5!&7TE.150V+ H)049?4D]310D]"5!&7U)/4T4L" E! M1E]$14-N970)/0E01E]$14-N970L" E!1E].151"155)"3T)4$9?3D540D55 M15DL" E!1E].151,24Y+"3T)4$9?3D543$E.2RP*"4%&7U)/551%"3T)4$9? M4D]55$4L" E!1E]004-+150)/0E01E]004-+150L" E!1E]!4T )/0E01E]! M4T L" E!1E]%0T].150)/0E01E]%0T].150L" E!1E]!5$U35D,)/0E01E]! M5$U35D,L" E!1E]33D$)/0E01E]33D$L" E!1E])4D1!"3T)4$9?25)$02P* M"4%&7U!04$]8"3T)4$9?4%!03U L" E!1E]704Y025!%"3T)4$9?5T%.4$E0 M12P*"4%&7T),54543T]42 D]"5!&7T),54543T]42"P*"4%&7TU!6 D]"5!& M7TU!6#L M+ D)+RH 4V5Q=65N8V5D+"!R96QI86)L92P 8V]N;F5C=&EO;BUB87-E9 H) M"0D)(" 8GET92!S=')E86US+B *B\*("!33T-+7T1'4D%-(#T ,BP)"2\J M($-O;FYE8W1I;VYL97-S+"!U;G)E;&EA8FQE(&1A=&%G<F%M<PH)"0D)(" M;V8 9FEX960 ;6%X:6UU;2!L96YG=& N(" J+PH (%-/0TM?4D%7(#T ,RP) M"0DO*B!287< <')O=&]C;VP :6YT97)F86-E+B *B\*("!33T-+7U)$32 ] M;VYN96-T:6]N+6)A<V5D+ H)"0D)(" 9&%T86=R86US(&]F(&9I>&5D(&UA M>"!S<&5C:69I8R!W87D ;V8 9V5T=&EN9R!P86-K971S" D)"0D ("!A="!T M:&4 9&5V(&QE=F5L+B 1F]R('=R:71I;F< <F%R<"!A;F0*"0D)"2 (&]T M:&5R('-I;6EL87( =&AI;F=S(&]N('1H92!U<V5R(&QE=F5L+B J+PI]" IA M;&EA<R!?7W-O8VME=%]T>7!E+E-/0TM?4U1214%-"5-/0TM?4U1214%-.PIA M87, 7U]S;V-K971?='EP92Y33T-+7U)!5PE33T-+7U)!5SL*86QI87, 7U]S M;V-K971?='EP92Y33T-+7U)$30E33T-+7U)$33L*86QI87, 7U]S;V-K971? M='EP92Y33T-+7U-%45!!0TM%5 E33T-+7U-%45!!0TM%5#L*86QI87, 7U]S M;V-K971?='EP92Y33T-+7U!!0TM%5 E33T-+7U!!0TM%5#L*"G-T<G5C="!H M;W-T96YT"GL*("!C:&%R("IH7VYA;64["0D)+RH 3V9F:6-I86P ;F%M92!O M9B!H;W-T+B *B\*("!C:&%R("HJ:%]A;&EA<V5S.PD)+RH 06QI87, ;&ES M="X ("HO"B :6YT(&A?861D<G1Y<&4["0DO*B!(;W-T(&%D9')E<W, ='EP M92X ("HO"B :6YT(&A?;&5N9W1H.PD)"2\J($QE;F=T:"!O9B!A9&1R97-S M+B *B\*("!C:&%R("HJ:%]A9&1R7VQI<W0["0DO*B!,:7-T(&]F(&%D9')E M<W-E<R!F<F]M(&YA;64 <V5R=F5R+B *B\*(" O+V-H87(J(&A?861D<CUH M7V%D9')?;&ES=%LP73L*?0H*<W1R=6-T(&YE=&5N="!["B 8VAA<B J;E]N M86UE.PH (&-H87( *BIN7V%L:6%S97,["B :6YT(&Y?861D<G1Y<&4["B M=6EN="!N7VYE=#L*?0H*<W1R=6-T(&EN7V%D9'(*("!["B ("!I;E]A9&1R M7W0 <U]A9&1R.PH ('T*"G-T<G5C="!I;C9?861D< H ('L*(" ('5N:6]N M(%]?:6XV7W4*(" (" >PH)=6)Y=&4)=39?861D<CA;,39=.PH)=7-H;W)T M('4V7V%D9'(Q-ELX73L*"75I;G0 =39?861D<C,R6S1=.PH (" ("!]" D M(%]?:6XV7W4 :6XV7W4["B ?0H*<W1R=6-T('-O8VMA9&1R"B >PH (" M<R!F86UI;'D 86YD(&QE;F=T:"X ("HO"B ("!C:&%R('-A7V1A=&%;,31= M.PD)+RH 061D<F5S<R!D871A+B *B\*("!]" IC;VYS="!I;G0 7U]33T-+ M;V-K861D<E]I; H ('L*(" ('-A7V9A;6EL>5]T('-I;E]F86UI;'D["B M("!I;E]P;W)T7W0 <VEN7W!O<G0["0D)+RH 4&]R="!N=6UB97(N(" J+PH M(" :6Y?861D<B!S:6Y?861D<CL)"2\J($EN=&5R;F5T(&%D9')E<W,N(" J M+PH*(" ("\J(%!A9"!T;R!S:7IE(&]F(&!S=')U8W0 <V]C:V%D9'(G+B M0T]-34].7U-)6D4 +0H)"0D ("!I;E]P;W)T7W0N<VEZ92 M" D)"2 (&EN M7V%D9'(N<VEZ95T <VEN7WIE<F\O*CUN97< 8VAA<BHO.PH ('T*"G-T<G5C M="!S;V-K861D<E]I;C8*("!["B ("!S85]F86UI;'E?="!S:6XV7V9A;6EL M>3L*(" (&EN7W!O<G1?="!S:6XV7W!O<G0["2\J(%1R86YS<&]R="!L87EE M<B!P;W)T(", *B\*(" ('5I;G0 <VEN-E]F;&]W:6YF;SL)+RH 25!V-B!F M;&]W(&EN9F]R;6%T:6]N("HO"B ("!I;C9?861D<B!S:6XV7V%D9'(["2\J M($E0=C8 861D<F5S<R J+PH (" =6EN="!S:6XV7W-C;W!E7VED.PDO*B!) M4'8V('-C;W!E+6ED("HO"B ?0H*<W1R=6-T(&]S;V-K861D< H ('L*(" M('5S:&]R="!S85]F86UI;'D["B ("!C:&%R('-A7V1A=&%;,31=.PH ('T* M;G,N(" J+PH (%-(551?5U(L"0DO*B!.;R!M;W)E('1R86YS;6ES<VEO;G,N M(" J+PH (%-(551?4D174 D)+RH 3F\ ;6]R92!R96-E<'1I;VYS(&]R('1R M86YS;6ES<VEO;G,N(" J+PI]" IS=')U8W0 :6]V96,*("!["B ("!V;VED M("II;W9?8F%S93L)+RH 4&]I;G1E<B!T;R!D871A+B *B\*(" ('5I;G0 M:6]V7VQE;CL)+RH 3&5N9W1H(&]F(&1A=&$N(" J+PH ('T*"G-T<G5C="!M M<V=H9'(*("!["B ("!V;VED("IM<V=?;F%M93L)"2\J($%D9')E<W, =&\ M<V5N9"!T;R]R96-E:79E(&9R;VTN(" J+PH (" <V]C:VQE;E]T(&US9U]N M86UE;&5N.PDO*B!,96YG=& ;V8 861D<F5S<R!D871A+B *B\*"B ("!I M;W9E8R J;7-G7VEO=CL)+RH 5F5C=&]R(&]F(&1A=&$ =&\ <V5N9"]R96-E M:79E(&EN=&\N(" J+PH (" :6YT(&US9U]I;W9L96X["0DO*B!.=6UB97( M;V8 96QE;65N=', :6X =&AE('9E8W1O<BX ("HO" H (" =F]I9" J;7-G M7V-O;G1R;VP["0DO*B!!;F-I;&QA<GD 9&%T82 H96< 0E-$(&9I;&5D97-C M('!A<W-I;F<I+B J+PH (" <V]C:VQE;E]T(&US9U]C;VYT<F]L;&5N.PDO M*B!!;F-I;&QA<GD 9&%T82!B=69F97( ;&5N9W1H+B *B\*"B ("!I;G0 M;7-G7V9L86=S.PD)+RH 1FQA9W, ;VX <F5C96EV960 ;65S<V%G92X ("HO M(&EN="!?7W1Y<&4L(&EN="!?7W!R;W1O8V]L*3L*"6EN="!S;V-K971P86ER M("AI;G0 7U]D;VUA:6XL(&EN="!?7W1Y<&4L(&EN="!?7W!R;W1O8V]L+ H) M"2 (" ("!I;G0 7U]F9'-;,ETI.PH):6YT(&)I;F0 *&EN="!?7V9D+"!S M;V-K861D<BH 7U]A9&1R+"!S;V-K;&5N7W0 7U]L96XI.PH):6YT(&=E='-O M8VMN86UE("AI;G0 7U]F9"P <V]C:V%D9'(J(%]?861D<BP*"0D)<V]C:VQE M;E]T("H 7U]L96XI.PH):6YT(&-O;FYE8W0 *&EN="!?7V9D+"!S;V-K861D M<BH 7U]A9&1R+"!S;V-K;&5N7W0 7U]L96XI.PH):6YT(&=E='!E97)N86UE M("AI;G0 7U]F9"P <V]C:V%D9'(J(%]?861D<BP*"0D)<V]C:VQE;E]T("H M7U]L96XI.PH):6YT('-E;F0 *&EN="!?7V9D+"!V;VED("I?7V)U9BP =6EN M="!?7VXL(&EN="!?7V9L86=S*3L*"6EN="!R96-V("AI;G0 7U]F9"P =F]I M9" J7U]B=68L('5I;G0 7U]N+"!I;G0 7U]F;&%G<RD[" EI;G0 <V5N9'1O M("AI;G0 7U]F9"P =F]I9" J7U]B=68L(&EN="!?7VXL" D)(" (" (&EN M="!?7V9L86=S+"!S;V-K861D<BH 7U]A9&1R+ H)"2 (" ("!S;V-K;&5N M7W0 7U]A9&1R7VQE;BD[" EI;G0 <F5C=F9R;VT *&EN="!?7V9D+"!V;VED M("H 7U]B=68L(&EN="!?7VXL(&EN="!?7V9L86=S+ H)"0D <V]C:V%D9'(J M(%]?861D<BP <V]C:VQE;E]T("H 7U]A9&1R7VQE;BD[" EI;G0 <V5N9&US M9R H:6YT(%]?9F0L(&US9VAD<B J7U]M97-S86=E+"!I;G0 7U]F;&%G<RD[ M" EI;G0 <F5C=FUS9R H:6YT(%]?9F0L(&US9VAD<B J7U]M97-S86=E+"!I M;G0 7U]F;&%G<RD[" EI;G0 9V5T<V]C:V]P=" H:6YT(%]?9F0L(&EN="!? M7VQE=F5L+"!I;G0 7U]O<'1N86UE+ H)"2 (" ("!V;VED("H 7U]O<'1V M86PL" D)(" (" ('-O8VML96Y?=" J(%]?;W!T;&5N*3L*"6EN="!S971S M;V-K;W!T("AI;G0 7U]F9"P :6YT(%]?;&5V96PL(&EN="!?7V]P=&YA;64L M" D)(" (" ('9O:60 *E]?;W!T=F%L+"!S;V-K;&5N7W0 7U]O<'1L96XI M.PH):6YT(&QI<W1E;B H:6YT(%]?9F0L(&EN="!?7VXI.PH):6YT(&%C8V5P M=" H:6YT(%]?9F0L<V]C:V%D9'(J(%]?861D<BP*"0D ("!S;V-K;&5N7W0 M*B!?7V%D9')?;&5N*3L*"6EN="!S:'5T9&]W;B H:6YT(%]?9F0L(&EN="!? M7VAO=RD[" EH;W-T96YT("IG971H;W-T8GEN86UE("AC:&%R("I?7VYA;64I M.PH)=F]I9"!S971H;W-T96YT("AI;G0 7U]S=&%Y7V]P96XI.PH)=F]I9"!E M;F1H;W-T96YT(" I.PH):&]S=&5N=" J9V5T:&]S=&5N=" H*3L*"6AO<W1E M;G0 *F=E=&AO<W1B>6%D9'( *'9O:60 *E]?861D<BP <V]C:VQE;E]T(%]? M;&5N+ H)"0D)(" (" :6YT(%]?='EP92D[" EV;VED('-E=&YE=&5N=" H M:6YT(%]?<W1A>5]O<&5N*3L*"79O:60 96YD;F5T96YT(" I.PH);F5T96YT M("IG971N971E;G0 *"D[" EN971E;G0 *F=E=&YE=&)Y861D<B H=6EN="!? M7VYE="P :6YT(%]?='EP92D[" EN971E;G0 *F=E=&YE=&)Y;F%M92 H8VAA M<B J7U]N86UE*3L*"75I;G0 ;G1O:&P *'5I;G0 7U]N971L;VYG*3L*"75S M:&]R="!N=&]H<R H=7-H;W)T(%]?;F5T<VAO<G0I.PH)=6EN="!H=&]N;" H M=6EN="!?7VAO<W1L;VYG*3L*"75S:&]R="!H=&]N<R H=7-H;W)T(%]?:&]S +='-H;W)T*3L*?0H` ` end
May 21 2003
"Carlos Santander B." <carlos8294 msn.com> escribiσ en el mensaje news:bah52n$fpc$1 digitaldaemon.com... | | However, for some reason, the server doesn't seem to go beyond the socket() | function (if I could debug it, it could be better). | I tried it again, and it seems that I had commited a coding mistake initializing one of the structs in the client (so the server was alright...). The only change I had to do in Socket.d was declare bcopy, and then it worked perfectly. I also tried to include select, pselect, etc., but I ran into some trouble with FD_SET et al because of my lack of knowledge with asm. Carlos Santander "Carlos Santander B." <carlos8294 msn.com> escribiσ en el mensaje news:bah52n$fpc$1 digitaldaemon.com... | | However, for some reason, the server doesn't seem to go beyond the socket() | function (if I could debug it, it could be better). | I tried it again, and it seems that I had commited a coding mistake initializing one of the structs in the client (so the server was alright...). The only change I had to do in Socket.d was declare bcopy, and then it worked perfectly. I also tried to include select, pselect, etc., but I ran into some trouble with FD_SET et al because of my lack of knowledge with asm. Carlos Santander
May 24 2003