Subject: Re: sockets on WinNT and UNIX
From: [email-masked] (Larry Gerhardstein)

21 Mar 1997 09:53:22 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Philippe Le Parc <[email-masked]>
Original-CC: [email-masked], [email-masked]
Original-Sender: [email-masked]

Philippe Le Parc wrote:
> 
> Hello,
> 
> I try to use sockets : I want to make a client on WinNT and a server on
> Unix.
> 
> I have made two small programs : a client send a message on a socket and
> the server just respond.
> When I compile both program on Unix (of course with gcc) and I execute
> the two programs on Unix, it works.
> When I compile both program on WinNT (with gcc-cygnus-2.7.1-960712)
> and I execute the two programs on WinNT, it works.
> But when I tried to make a connection between the client on WinNT and
> the server on Unix, I have a "connection refused" message.

The error "connection refused" ECONNREFUSED can happen when a client
attepmts to connect to a server host using an inactive service port
number, i.e., there is no listener for the service port number.

This above would happen if the port which the client is attempting to
connect with has no corresponding entry in inetd.conf, and there is no
detached server listening on the port in question.

Make certain that the client code and the server are in fact using the
same port number.  Note that on many processors, byte order is
different, e.g. Sun and Intel.  You must be careful to use byte order
portability functions htons() and ntohs() properly when dealing with
port number.  Otherwise, the port your client is telling the server to
connect is actually the byte swap of what you intend.

As a test, calculate the byte swap of your port number and use that port
number at the client.  See what happens then.

--
Larry Gerhardstein, Kennewick, Washington
[email-masked]    (at home)
[email-masked]  (at work)
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".