Is it possible to delay response to client?

74 views
Skip to first unread message

Marko M.

unread,
Apr 2, 2011, 8:47:46 AM4/2/11
to spserver
Hello,

Is it possible to delay response to client in spserver, so that you
wouldn't have to give an answer to client right away in the message
handler?
I'm asking because I have to do asyncronous IO calls to databases and
disk. I don't want to wait in a blocking state in my handler function
for the slow operations to finish.

So would it be possible to put client in a waiting state in the
handler,
find the client after the asynchronous calls are done (using the
client's id) and *then* send the response?

If not, do you think it would be hard to tweak the framework to allow
that?

-Marko

iunknown

unread,
Apr 7, 2011, 1:58:23 AM4/7/11
to spserver

Use the dispatcher class.
1.Add a queue. Push (sid, request) to queue and return empty response
in handler.
2.Add a threadpool. Pop (sid, request) from queue to process, generate
response, and send back to client.
Reply all
Reply to author
Forward
0 new messages