This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Re: sockets on WinNT and UNIX
- To: Philippe Le Parc <Philippe dot Le-Parc at doelan-gw dot univ-brest dot fr>
- Subject: Re: sockets on WinNT and UNIX
- From: Larry Gerhardstein <Larry at 3-cities dot com>
- Date: Thu, 20 Mar 1997 22:17:13 -0800
- CC: gerhardstein at pnl dot gov, gnu-win32 at cygnus dot com
- References: <199703201617.RAA04374@lepouldu.ubolimi>
- Reply-To: Larry at 3-cities 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@3-cities.com (at home)
gerhardstein@pnl.gov (at work)
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".