473,695 Members | 2,510 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 4405
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
6773
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
4164
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
2673
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
13398
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
5262
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
1717
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
2275
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
7552
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
8642
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...
1
8861
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
8833
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7673
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
5841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4349
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
4588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3021
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
2283
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.