SocketServer Problem

E

Ergin Aytac

I'm trying to run a script written in python and have some socket
connection problems. I cutted the origin script (more than 1000 lines)
so it is only the part of the connection and there is no functionalty
but connecting to a server.
I have no idea about programming with python so every hint is a present
for me :)

------------------------------------
import SocketServer
import os

nntp_hostname = 'news.chello.at'
nntp_port = 119

if os.name == 'posix':
class NNTPServer(SocketServer.ForkingTCPServer):
allow_reuse_address = 1
max_children = 20
else:
class NNTPServer(SocketServer.ThreadingTCPServer):
allow_reuse_address = 1

class NNTPRequestHandler(SocketServer.StreamRequestHandler):
# this is the list of supported commands
def handle(self):
self.input = self.rfile.read(1024)
print self.input

print os.name
print nntp_hostname
print nntp_port

server = NNTPServer((nntp_hostname, nntp_port), NNTPRequestHandler)
-------------------------------------

I get the following error on windows:
File "D:\tmp\test\test.py", line 27, in ?
server = NNTPServer((nntp_hostname, nntp_port), NNTPRequestHandler)
File "D:\PYTHON23\lib\SocketServer.py", line 330, in __init__
self.server_bind()
File "D:\PYTHON23\lib\SocketServer.py", line 341, in server_bind
self.socket.bind(self.server_address)
File "<string>", line 1, in bind
socket.error: (10049, "Can't assign requested address")

On Linux I get the same message but the error number is 99, "Can't
assign requested address"

- I tried with python 2.3.2 on windows and linux
- I tried with python 2.3.4 on windows and linux
- I tried with other servers and ports ..
- I tried without firewall ..
- I tried with user root on linux ..
- I tried with ip instead of domain name ...
- I tried on 7 other boxes with 3 other isp with and without firewall ...
- I also tried the original script ...

.... but nothing changed.

telnet works fine with every server and port I used for the tests.
The script above worked without any error message on a box of friend.

If you have any idea please let me know.
thanx

Ergin
 
I

Irmen de Jong

Ergin said:
nntp_hostname = 'news.chello.at'
nntp_port = 119


I very much doubt it that the computer you are trying to run
the program on, is actually called "news.chello.at"....
socket.error: (10049, "Can't assign requested address")

You cannot bind a socket on an address that is not 'yours' ...
The script above worked without any error message on a box of friend.

Now that is weird. Unless your friend works for Chello and his
box is "news.chello.at"...

--Irmen
 
E

Ergin Aytac

The origin script is a gateway for syncronizing news on usenet servers.
As I can see there are a lot of people who use this script for public
usenet groups. I saw some using it for news.php.net, news.mozilla.org
without being a part of this domains. Besides I have the access rights
for news.chello.at which recognizes me over the domain name I'm using.
Without any access rights I should also get access to a few public
groups. The friend who tried this server without any errors doesn't work
for chello and his box is not a part of chello.

Something is strange here...

Can I bind a socket to an address that is public and has no access
limits? (like public usenet servers as news.php.net or news.mozilla.org)
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top