delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/03/21/09:53:22

From: Larry AT 3-cities DOT com (Larry Gerhardstein)
Subject: Re: sockets on WinNT and UNIX
21 Mar 1997 09:53:22 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <333227E9.7D6C.cygnus.gnu-win32@3-cities.com>
References: <199703201617 DOT RAA04374 AT lepouldu DOT ubolimi>
Reply-To: Larry AT 3-cities DOT com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Philippe Le Parc <Philippe DOT Le-Parc AT doelan-gw DOT univ-brest DOT fr>
Original-CC: gerhardstein AT pnl DOT gov, gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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
larry AT 3-cities DOT com    (at home)
gerhardstein AT pnl DOT gov  (at work)
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019