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.SecureXMLR PCServer.Secure XMLRPCServer(
server_address,
RequestHandler,
KEYFILE,CERTFIL E,
allow_none=True ,
logger =
servicelog.getL ogger('SecureXM LRPCServer',fil ename=LOGFILENA ME),
logRequests=Fal se,
stop_requested = stop_requested
)
rpcserver = RPCServer() # Object containing public RPC methods.
server.register _instance(rpcse rver)
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_even t()
#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_eve nt(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(objec t):
"""Object containing public RPC methods."""
def method1(self,ar g1):
.....
def method2(self,ar g1):
.....
def method3(self,ar g1):
.....
@nonblocking
def get_event1(self ):
try:
# Wait for 10 seconds until an event is available.
return self.asinharves ter.queued_even ts1.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.asinharves ter.queued_even ts2.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 "nonblockin g" decorator.
Thanks,
Laszlo 0 1002 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 are written in C#
The server is quite simple: two threads, one accepts new connections
and decides whether the client is authenticated to send data or not, and
the other thread serves already connected clients: performs a
Socket.Select and then...
|
by: Jim Hubbard |
last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
|
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 services are disabled. The
code and unhandeled exception message, is below.
Thanks
Dan Reber
|
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 written in C#
The server is quite simple: two threads, one accepts new
connections and decides whether the client is authenticated to send data
or not, and the other thread serves already connected clients: performs
a Socket.Select and then gets...
|
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
String, Optional ByVal ConnectionParamList As String = Nothing) As
String
| |
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 Server.Transfer-Comments).
What seems very strange is that each corresponding request shows as
user agent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4" even though the requests
come from different IPs from all...
|
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 VS2003 and i have iis 6 installed
thanks for time and for ur fast reply
|
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 is
intermittent -- sometimes it happens and sometimes not from the same screen
with the same data.
Here is the error:
|
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, but when using the C# COM server, there is a strange
error indicating dll is not installed correctly (data link error).
I have tried to delete the DLL at the same time to test whether the DLL
could be found correctly when the client is invoking...
|
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; }
|
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...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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,...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |