By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,498 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

SocketServer Problem

P: n/a
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.StreamRequestHandl er):
# 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
Jul 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ergin Aytac wrote:
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
Jul 18 '05 #2

P: n/a
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)

Irmen de Jong schrieb:
Ergin Aytac wrote:
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

Jul 18 '05 #3

P: n/a
Ergin Aytac wrote:
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)


No.

But you can _connect_ to it, which is a very different thing...
Have you read the socket howto? http://www.amk.ca/python/howto/sockets/

--Irmen
Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.