469,952 Members | 2,532 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,952 developers. It's quick & easy.

Listening socket not seen outside of localhost

Hi,

As I don't know if my problem is python, platform or non-specific, I try
to post my question here, as you may have made similar experiences.

I try to write a simple chatserver, using the socket module. Everything
works fine, as long as I'm trying to connect to the server from the host,
the server is running. If I try to access the server from another computer
in my local network, the connection is refused.

No firewall is running and other services (like ssh or httpd) can be
connected to.
I'm running Python 2.3.4 on a AMD Athlon using Fedora Core 2.

I initialize the sockets the following way:
self._addr = socket.gethostname()
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
True)
self.socket.bind((self._addr, self._port))
self.socket.listen(self._backlog)

Then I'm accepting clients in an endless loop.

Do you know, why the server is just seen locally?
(I did nmap from a remote host in my LAN and netstat also shows the server
listening)

Christian
Jul 18 '05 #1
2 2559
Christian von Essen wrote:
I initialize the sockets the following way:
self._addr = socket.gethostname()
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,
True)
self.socket.bind((self._addr, self._port))
self.socket.listen(self._backlog)


What does self._addr look like? Its supposed to be '' and not 'localhost',
otherwise the bind will only bind to the lo-interface.

Regards,

Diez
Jul 18 '05 #2
On Mon, 21 Jun 2004 17:59:46 +0200, Diez B. Roggisch wrote:

What does self._addr look like? Its supposed to be '' and not 'localhost',
otherwise the bind will only bind to the lo-interface.

Regards,

Diez

It was my hostname, so bind was just to lo-interface - now it's working,
thanks a lot

Christian
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by 127.0.0.1 | last post: by
1 post views Thread by kvdvm | last post: by
3 posts views Thread by Laszlo Csabi | last post: by
reply views Thread by Marc Bogaard | last post: by
reply views Thread by Vladimir Lushnikov | last post: by
1 post views Thread by =?Utf-8?B?aXdkdTE1?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.