M
macapone
Hi Folks,
I'm trying to write a TCP server that will process and respond to
client XML queries. Nothing new there, plenty of examples on the web.
But here's the catch...
When a client connects, the connection is persistent, similar to a chat
server. the client "chats" a request and gets a response, chats
another request, etc. However, some requests are long-running, and
while waiting for a response to request #1, the client should be able
to send requests #2 and #3 and get responses (without having to open a
new connection to the server).
The only way to do this is to either fork or thread the request
processing code on the server.
Right now I'm using Net:
aemon as my server, although I'm certainly
open to alternatives. I've also looked at POE and a few other modules
out there. Basically, I need my handle_request() function to somehow
asynchronously process the request and then communicate the result back
to the client (via event handler? signal? fork? not sure...) when it
has finished processing. It seems as though all the examples out there
are geared towards forking/spawing/etc when a connection is made, and
closing that connection when finished. But I'm looking to keep the
connection open and be able to send requests and get responses
asynchronously.
I'm hoping someone out there has done this and can point me in the
right direction. Any thoughts?
Thanks in advance!
MAC
I'm trying to write a TCP server that will process and respond to
client XML queries. Nothing new there, plenty of examples on the web.
But here's the catch...
When a client connects, the connection is persistent, similar to a chat
server. the client "chats" a request and gets a response, chats
another request, etc. However, some requests are long-running, and
while waiting for a response to request #1, the client should be able
to send requests #2 and #3 and get responses (without having to open a
new connection to the server).
The only way to do this is to either fork or thread the request
processing code on the server.
Right now I'm using Net:
open to alternatives. I've also looked at POE and a few other modules
out there. Basically, I need my handle_request() function to somehow
asynchronously process the request and then communicate the result back
to the client (via event handler? signal? fork? not sure...) when it
has finished processing. It seems as though all the examples out there
are geared towards forking/spawing/etc when a connection is made, and
closing that connection when finished. But I'm looking to keep the
connection open and be able to send requests and get responses
asynchronously.
I'm hoping someone out there has done this and can point me in the
right direction. Any thoughts?
Thanks in advance!
MAC