Connecting Tech Pros Worldwide Forums | Help | Site Map

socket object, connection refused ...

Maxim Olivier-Adlhoch
Guest
 
Posts: n/a
#1: Jul 18 '05
hello ,

this is my first post on this list. I've been told its very helpfull, I hope someone can help me with my problem.


I've been building a specialized client server application using the socket object.

I am on a variety of windows (NT 2000 XP).

I've been coding the engine, using local host on server and client for 2 months ALL is going ok. never had any tcp/ip problems.

now I decide to share the server and start doing actual network tests and the server always refuses to have a client connect.

I have snooped the network traffic and it does reach the remote machine. Only, the server always send a RST (reset) message back and this causes my client script to display a connection refused message.

so I decided to test using the machine locally in different ways:

using 'localhost' or '127.0.0.1' always works, using my actual machine's ip or its hostname does not!!

I've tried all kinds of different server port (above and below 1024, 10000, 50000) but I have the same problem each time.



-MAx
---
"You can either be part of the problem or part of the solution, but in the end, being part of the problem is much more fun."



Rene Pijlman
Guest
 
Posts: n/a
#2: Jul 18 '05

re: socket object, connection refused ...


Maxim Olivier-Adlhoch:[color=blue]
>using 'localhost' or '127.0.0.1' always works, using my actual machine's ip or its hostname does not!![/color]

What is the server socket binding to?

"Connection refused" normally means there is no server listening for
connections on the specified IP/port-combination.

--
René Pijlman
Diez B. Roggisch
Guest
 
Posts: n/a
#3: Jul 18 '05

re: socket object, connection refused ...


Hi,
[color=blue]
> using 'localhost' or '127.0.0.1' always works, using my actual machine's
> ip or its hostname does not!![/color]

I had the exact problem last week - I think there should be an update to the
docs, as these say:

<quote from socket example>
# Echo server program
import socket

HOST = '' # Symbolic name meaning the local host

</quote from socket example>

Unfortunately, this is not right - what happens wheny you bind localhost or
127.0.0.1, the socket _only_ listens on your local loop back device. When
binging to '', this means "bind to all IPs of this machine" - and thats
exactly what you are looking for.

So try to either explictely bind to your IP, or '' - that will help.

Regards,

Diez
Closed Thread