473,657 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Sock etServer.Forkin gTCPServer):
allow_reuse_add ress = 1
max_children = 20
else:
class NNTPServer(Sock etServer.Thread ingTCPServer):
allow_reuse_add ress = 1

class NNTPRequestHand ler(SocketServe r.StreamRequest Handler):
# 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((nnt p_hostname, nntp_port), NNTPRequestHand ler)
-------------------------------------

I get the following error on windows:
File "D:\tmp\test\te st.py", line 27, in ?
server = NNTPServer((nnt p_hostname, nntp_port), NNTPRequestHand ler)
File "D:\PYTHON23\li b\SocketServer. py", line 330, in __init__
self.server_bin d()
File "D:\PYTHON23\li b\SocketServer. py", line 341, in server_bind
self.socket.bin d(self.server_a ddress)
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 4404
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.or g
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.or g)

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.or g)


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
6767
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 = self.rfile.read(1024)
3
4163
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 the same thing the socketserver module, it's ok for the client, but I don't succeed in making work the server :-(( Here is the client (which works)
0
2932
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 GreetingHandler(SocketServer.BaseRequestHandler): '''Class to handle sending a greeting to a client '''
5
2668
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 of code in the program result in the errors given below: import SocketServer print "SocketServer imported"
12
13393
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 handle_request loop instead of serve_forever, it still seems difficult: class myserver(ThreadingMixIn, TCPServer): pass server = myserver(...) server.shutdown = False while not server.shutdown: server.handle_request()
4
5260
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 the details of my code (on request available, though), here is what I do : I have a TCPServer and BaseRequestHandler .
0
1710
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? import SocketServer import logging as l l.basicConfig(level=l.DEBUG,
5
2274
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 and answers requests. All went fine until I realized that I have to sometimes stop the server - which is where I ran into a problem. Python threads can not be killed after they've been started. They can be kindly requested to
4
7551
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 cPickle. I've also tried using pickle (instead of cPickle), but I get the same response. Below is the code. I'll put the rest of my comments after the code
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8502
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.