473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SocketServer Problem

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
3 4391
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: lebo | last post by:
So I'm new to this python stuff - and this has me stumped # server import SocketServer PORT = 8037 class myRequestHandler(SocketServer.StreamRequestHandler): def handle(self): self.input...
3
by: Olivier Hoarau | last post by:
Hello, I have build a client/server application with the socket module. The server mades UDP broadcasting and the client only reads UDP broadcast messages. All work fine. Now I want to use for...
0
by: Adil Hasan | last post by:
Hello Fred, I just ran across your question. I think that the following code will work: ----- SERVER CODE ------ import SocketServer import time class...
5
by: missiplicity | last post by:
Hi, I am newbie to Python language and am taking my baby steps. I am using Python2.4 from ActiveState on W2K. I am trying to create a simple SocketServer program. Just adding the following 2 lines...
12
by: Paul Rubin | last post by:
Let's say you have a SocketServer with the threading mix-in and you run serve_forever on it. How can you shut it down, or rather, how can it even shut itself down? Even if you use a...
4
by: google | last post by:
Dear newsgroup, I give up, I must be overseeing something terribly trivial, but I can't get a simple (Java) applet to react to incoming (python) SocketServer messages. Without boring you with...
0
by: Tomi Hautakoski | last post by:
Hello, I'm a Python newbie trying to figure out how to use SocketServer with IPv6. I would like to set up a TCPServer working like below but how to tell SocketServer I need to use AF_INET6? ...
5
by: eliben | last post by:
Hello, I have a small wxPython application. Today I was trying to add some RPC capability to it, so I implemented an instance of SimpleXMLRPCServer that runs in a separate thread when invoked...
4
by: Daniel | last post by:
Hello, I'm trying to build a very simple IPC system. What I have done is create Data Transfer Objects (DTO) for each item I'd like to send across the wire. I am serializing these using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.