You could either:
(1) Not reply to the client until after 10 seconds (using a TTimer?).  You
don't have to sleep.  I'm sure the HTTP server has some kind of delayed
reply mechanism.  You can put the client in a 'waiting' list and only send
the reply after your timeout.

(2) Have the client only retry after 10 seconds.  There is a header you can
send to get the client to refresh to a new URL after so many seconds.  Many
sites use it for redirects...they redirect after 5 seconds for example.

Dan

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Cosmin Prund
Sent: 18 November 2006 12:55
To: ICS support mailing
Subject: [twsocket] Multi-Threaded THttpServer?

Hello!

Here's me again, trying to do strange things. I'm working on a HelpDesk 
application that should include a Chat function, amongst other things. I 
want to do it all using HTTP only (that is, no direct connection, 
everything needs to be pure HTTP). I really want this HTTP-only thing 
because I want my application to work in places where my clients only 
have access to the Internet using an HTTP Proxy!

The chat application has 2 basic components: send your text, receive 
text sent by the other party. The "send your text" is really easy, but 
the "receive text sent by the other party" part is a bit more difficult, 
because I can't keep an open connection between client and server, I 
need the client to pool for text sent from the server! That is, the 
client will GET a document of the following format:
http://myserver.server.ro/getchat?conversation=12346&seq=1
The server should return any available text for the given conversation 
or an NOP if no text is available. But here's a trick: If there's no 
text available for the connection I would like to delay returning an NOP 
until there IS some text available, or until a 10 seconds delay elapses. 
This would stop the client from going into a bandwidth-consuming busy-loop.

Unfortunately THttpServer doesn't include a "MultiThreaded" checkbox 
like TSocketServer does, and I'm not sure what I should do to Sleep() 
without actually freezing the server in the process! I might try 
subclassing THttpServer and setting FWSocketServer.MultiThreaded = True 
in CreateSocket but I know too little about the internals of THttpServer 
and ICS in general to understand the consequences of doing this.

Any help on the matter is welcomed, thanks.

--
Cosmin Prund
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to