Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Listening socket not seen outside of localhost

Reply
Thread Tools

Listening socket not seen outside of localhost

 
 
Christian von Essen
Guest
Posts: n/a
 
      06-21-2004
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
 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      06-21-2004
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
 
Reply With Quote
 
 
 
 
Christian von Essen
Guest
Posts: n/a
 
      06-21-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with pix inside->outside + dmz->outside + inside->outside->dmz Jack Cisco 0 09-19-2007 01:57 AM
How could I directly trigger a very simple on localhost and a known port listening server from my internet browser client? Marc Javascript 4 12-19-2005 08:51 AM
Interruptions in live news listening Realone Player listening Thaqalain Computer Support 6 07-16-2005 02:11 PM
Can I Reset the Root from localhost/myproject/ to localhost/ Alex ASP .Net 4 02-08-2005 01:45 PM
HttpModule -- how to intercept urls like http://localhost/abc/def or http://localhost/abc/def/ where abc, def are non virtual dir Jiong Feng ASP .Net 0 11-19-2003 05:29 AM



Advertisments