a problem with sockets

bzs at BU-CS.BU.EDU bzs at BU-CS.BU.EDU
Sun Jul 20 13:05:38 AEST 1986


>From: Moises Lejter
>...When the client is on a different
>machine from the server, the client call to "connect()" fails
>with a "connection refused" error...
>...I should mention that the problem
>seems to occur only when one of the machines is a SUN and the
>other a VAX; when both processes are on VAXes only, or on SUNs
>only, they work just fine.

In the server and client's main()s change:

	inet_host.sin_port = INET_PORT;
to
	inet_host.sin_port = htons(INET_PORT);

Remember that a VAX is byte-swapped relative to the network,
the above macro fixes it on the VAX (and leaves it alone
on the SUN, it's a no-op.) You got "connection refused" because
you were trying to rendezvous on the wrong socket number (you
get that message if there is noone listening on the requested
remote socket.) See 'man byteorder' for further details.

	-Barry Shein, Boston University



More information about the Comp.unix.wizards mailing list