Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > SocketServer Problem

Reply
Thread Tools

SocketServer Problem

 
 
Ergin Aytac
Guest
Posts: n/a
 
      06-25-2004
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
 
Reply With Quote
 
 
 
 
Irmen de Jong
Guest
Posts: n/a
 
      06-25-2004
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
 
Reply With Quote
 
 
 
 
Ergin Aytac
Guest
Posts: n/a
 
      06-25-2004
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

 
Reply With Quote
 
Irmen de Jong
Guest
Posts: n/a
 
      06-26-2004
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
 
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
SocketServer problem: client hangs trying to reconnect after server restart Massi Python 0 02-28-2011 10:58 AM
SocketServer accept() fails to work (Linux) Janusz Java 4 06-01-2004 12:44 PM
Problem Sending Data with SocketServer.ThreadingTCPServer UrgeOverkill Python 2 02-19-2004 11:56 PM
_socket / SocketServer / Mandrake Linux problem / Python 2.3 Barry Sprajc Python 1 08-03-2003 06:09 PM
SocketServer class - basis problem lebo Python 4 06-24-2003 01:42 PM



Advertisments