Socket Problems...

J

jtxx000

I'm having some trouble getting ruby sockets working... I have two
scripts: one for the client and one for the server. If I run the two
scripts on the same computer with them both set to connect to localhost
then it works fine, but if I run the scripts on different computers in
the same LAN with the server set to connect to localhost and the client
set to connect to the IP address of the server then I get "No
connection could be made because the target machine actively refused
it. - connect(2) (Errno::ECONNREFUSED)" Any ideas?

Thanks,
Caleb
 
E

Edward Faulkner

--zhXaljGHf11kAtnf
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I'm having some trouble getting ruby sockets working... I have two
scripts: one for the client and one for the server. If I run the two
scripts on the same computer with them both set to connect to localhost
then it works fine, but if I run the scripts on different computers in
the same LAN with the server set to connect to localhost and the client
set to connect to the IP address of the server then I get "No
connection could be made because the target machine actively refused
it. - connect(2) (Errno::ECONNREFUSED)" Any ideas?

If you set the server to listen on localhost it will only listen on
the loopback device. Don't set a listen address and it will listen to
everything:

TCPServer.new('',portnum)

--zhXaljGHf11kAtnf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDObdVnhUz11p9MSARAlIHAJ4iOrccW8nwJE1mgHpUH/Hq4zhMEgCg3Y/f
2uELPBSbLcqjlPKlnebrhQA=
=M7G/
-----END PGP SIGNATURE-----

--zhXaljGHf11kAtnf--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top