Newbie Question on TCP/IP client Server

I’ve attached sample code for a client and server test case that I’m trying
to get to work. The server and client boxes are setting right beside each
other. I can telnet, ping, and FTP to/from either box, so I know the IP
addresses are not wrong. However, the server never receives the request and
the client returns “Connection refused”. Can anyone help me?


begin 666 client1.c
M(VEN8VQU9&4@/’-Y<R]T>7!E<RYH/@T*(VEN8VQU9&4@/’-Y<R]S;V-K970N
M:#X-“B-I;F-L=61E(#QS=&1I;RYH/@T*(VEN8VQU9&4@/&YE=&EN970O:6XN
M:#X-“B-I;F-L=61E(#QA<G!A+VEN970N:#X-“B-I;F-L=61E(#QU;FES=&0N
M:#X-@T*:6YT(&UA:6XH0T>PT*“6EN=”!S;V-K9F0[#0H):6YT(&QE;CL-
M”@ES=’)U8W0@<V]C:V%D9’)?:6X@861D<F5S<SL-”@EI;G0@<F5S=6QT.PT*
M"6-H87(@8V@])T$G.PT*"0T*"7-O8VMF9#US;V-K970H049?24Y%5"P@4T]#
M2U]35%)%04TL,“D[#0H)#0H)861D<F5S<RYS:6Y?9F%M:6QY/4%&7TE.150[
M#0H)861D<F5S<RYS:6Y?861D<BYS7V%D9’(]:6YE=%]A9&1R*”(Q.3(N,38X
M+C$Q,"XR,3,B3L-"@EA9&1R97-S+G-I;E]P;W)T/3DW,S0[#0H-"@EL96X]
M<VEZ96]F
&%D9’)E<W,I.PT*“0T*“7)E<W5L=#UC;VYN96-T*’-O8VMF9"P@
M*’-T<G5C=”!S;V-K861D<B J29A9&1R97-S+"!L96XI.PT"0T*“6EF*’)E
M<W5L=” ]/2 M,2D@>PT*“0EP97)R;W(H(F]O<’,Z(&-L:65N=#$B3L-"@D)
M97AI="@Q
3L-”@D)?0T*“0T*“7=R:71E*’-O8VMF9"P@)F-H+#$I.PT*“7)E
M860H<V]C:V9D+” F8V@L,2D[#0H)<’)I;G1F*”)C:&%R(&9R;VT@<V5R=F5R
M(#T@)6-<;B(L8V@I.PT"6-L;W-E’-O8VMF9"D[#0H)97AI=”@P*3L-”@E]
`
end

begin 666 server.c
M(VEN8VQU9&4@/’-Y<R]T>7!E<RYH/@T*(VEN8VQU9&4@/’-Y<R]S;V-K970N
M:#X@("\O<F5Q=6ER97,@;&EN:VEN9R!W:71H(’-O8VME=’,@;&EB<F%R>2!C
M8R M;’-O8VME= T*(VEN8VQU9&4@/’-T9&EO+F@^#0HC:6YC;‘5D92 ;F5T
M:6YE="]I;BYH/@T*(VEN8VQU9&4@/&%R<&$O:6YE="YH/@T*(VEN8VQU9&4@
M/‘5N:7-T9"YH/@T*#0II;G0@;6%I;B@I#0I[#0H):6YT(’-E<G9E<E]S;V-K
M9F0L(&-L:65N=%]S;V-K9F0[#0H):6YT(’-E<G9E<E]L96XL(&-L:65N=%]L
M96X[#0H)<W1R=6-T(’-O8VMA9&1R7VEN(’-E<G9E<E]A9&1R97-S.PT*“7-T
M<G5C=”!S;V-K861D<E]I;B!C;&EE;G1?861D<F5S<SL-"@D-"@DO+V-R96%T
M92!A;B!U;FYA;65D(’-O8VME="!F;W(@=&AE(’-E<G9E<@T*“75N;&EN:R@B
M<V5R=F5R7W-O8VME=”(I.R O+R!F:7)S="!C;&]S92!A;GD@;VQD(&]N97,-
M"@ES97)V97)?<V]C:V9D/7-O8VME=“A!1E])3D54+”!33T-+7U-44D5!32PP
M3L-"@D-"@ES97)V97)?861D<F5S<RYS:6Y?9F%M:6QY/4%&7TQ/0T%,.PT
M"7-E<G9E<E]A9&1R97-S+G-I;E]A9&1R+G-?861D<CUI;F5T7V%D9’(H(C$Y
M,BXQ-C@N,3$P+C(Q,R(I.PT*"7-E<G9E<E]A9&1R97-S+G-I;E]P;W)T/3DW
M,S0[#0H)#0H)<V5R=F5R7VQE;CUS:7IE;V8H<V5R=F5R7V%D9’)E<W,I.PT*
M"6)I;F0H<V5R=F5R7W-O8VMF9"P@’-T<G5C="!S;V-K861D<B J29S97)V
M97)?861D<F5S<RP@<V5R=F5R7VQE;BD[#0H)#0H);&ES=&5N*’-E<G9E<E]S
M;V-K9F0L-2D[#0H)=VAI;&4H,2D@>PT*“0EC:&%R(&-H.PT*“0D-”@D)<’)I
M;G1F*”)S97)V97(@=V%I=&EN9UQN(BD[#0H)"0T*"0EC;&EE;G1?;&5N/7-I
M>F5O9BAC;&EE;G1?861D<F5S<RD[#0H)“7!R:6YT9B@B0F5F;W)E($%C8V5P
M=”(I.PT*"0EC;&EE;G1?<V]C:V9D/6%C8V5P=“AS97)V97)?<V]C:V9D+” H
M<W1R=6-T(’-O8VMA9&1R(“HI)F-L:65N=%]A9&1R97-S+” F8VQI96YT7VQE
M;BD[#0H)"7!R:6YT9B@B069T97(@06-C97!T(BD[#0H)"0T*"0ER96%D*&-L
M:65N=%]S;V-K9F0L("9C:"P@,2D[#0H)"6-HRL[#0H)"7=R:71E&-L:65N
M=%]S;V-K9F0L("9C:“PQ*3L-”@D)8VQO<V4H8VQI96YT7W-O8VMF9"D[#0H)
%"7T-"GT
end

You forgot to convert host to network order of the port number(
htons(9734)).And also you are setting the IP in the socket as the server ip
itself.I am not sure if that is allowed.Typically you should put the IP of
the client from which you are expecting connection or INADDR_ANY which
accepts connections from all the clients.

Hope it helps

Sreekanth

“Chris Rose” <esorcc@hotmail.com> wrote in message
news:a24pje$3j1$1@inn.qnx.com

I’ve attached sample code for a client and server test case that I’m
trying
to get to work. The server and client boxes are setting right beside each
other. I can telnet, ping, and FTP to/from either box, so I know the IP
addresses are not wrong. However, the server never receives the request
and
the client returns “Connection refused”. Can anyone help me?