473,386 Members | 1,962 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,386 software developers and data experts.

Want a strange XML RPC server


Hi,

I would like to have a strage XML RPC server. It should use one main
thread for all connections.

I have some code like this (using a custom RPC server class):
server_address = (LISTEN_HOST, LISTEN_PORT) # (address, port)
server = mess.SecureXMLRPCServer.SecureXMLRPCServer(
server_address,
RequestHandler,
KEYFILE,CERTFILE,
allow_none=True,
logger =
servicelog.getLogger('SecureXMLRPCServer',filename =LOGFILENAME),
logRequests=False,
stop_requested = stop_requested
)
rpcserver = RPCServer() # Object containing public RPC methods.
server.register_instance(rpcserver)

It works perfectly.

Now here is the tricky part. I would like to send back events. It is
implemented by an RPC callback:

#1. client calls server.get_event()
#2. server waits until the event happens (or until a given timeout)
#3. server returns the event (if any)

The clients are running on multiple threads, and the idea is that any
client can send an event by calling server.send_event(event).

That event will be returned to another client by the server. Since the
clients are blocking (waiting for the RPC call to return), events will
go from one client to another immediatelly (through the rpc server).
This goes through different kinds of proxies, and can be used from
different programming languages (Python and PHP clients, in my case...)

The problem is that in #2, waiting for the event to happen inside the
RPC server's handler method will block all other connections to the RPC
server.

Preferred solution: The get_event() method should run in a different
thread inside the server, and return the event to its xmlrpc client from
that thread. However, all other methods should use one main thread. I
would like to implement this as a decorator like:
class RPCServer(object):
"""Object containing public RPC methods."""
def method1(self,arg1):
.....
def method2(self,arg1):
.....
def method3(self,arg1):
.....

@nonblocking
def get_event1(self):
try:
# Wait for 10 seconds until an event is available.
return self.asinharvester.queued_events1.get(True,10)
except Queue.Empty:
return None # Indicates that there was no queued event.

@nonblocking
def get_event2(self):
try:
# Wait for 10 seconds until an event is available.
return self.asinharvester.queued_events2.get(True,10)
except Queue.Empty:
return None # Indicates that there was no queued event.
Is this possible? I have no idea how to write this "nonblocking" decorator.

Thanks,

Laszlo

Jan 8 '08 #1
0 983

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Grzegorz Kaczor | last post by:
Hello all, I've got a VERY strange network problem with Win2k Server and .NET. I've got one central server (hub) getting raw binary data (files) from many locations. Both server and clients...
14
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
0
by: Daniel Reber | last post by:
I am getting a strange unhandeled exception message. The same code is working on many serevrs but I am getting an error at this one. The server is locked down security wise and many of the windows...
0
by: Grzegorz Kaczor | last post by:
Hello, I've got a VERY strange network problem with Win2k Server and .NET. I've got one central server (hub) getting raw binary data (files) from many locations. Both server and clients are...
2
by: peter | last post by:
Hi, I have very strange situation but first description ;) I have: 1) project in VB.NET, in this f.e. 1 function: Public Function Login(ByVal UserName As String, ByVal UserPassword As...
0
by: AndreasJ.Mueller | last post by:
Hi Since we have moved our application (.NET 1.1) to a new server a few weeks ago we have seen in the event-logs multiple errors (which in itself is not my current problem, so I no...
5
by: Developer.Man4 | last post by:
when i try using HttpContext.Current.Server.MapPath(path) from a desktop application built using c# i get a System.NullReferenceException can anyone tell me why and what to do?? m using...
3
by: Shelly | last post by:
I am encountering two strange problems. First one: I get a "server misconfiguration error", but only sometimes. It occurs on the first screen that accesses the database on a submit. This error...
8
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I am migrating my C++ COM server to managed code (C# COM server). I am using the same client to use the same COM class in COM server. The C++ version COM server works properly,...
3
by: Tomasz J | last post by:
Hello Developers, I have a control derived from System.Web.UI.WebControls.WebControl. Control has this property: public string Value { set { _value = value; } get { return _value; }
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.