Re: Simultaneous requests in a gateway application

Mikhail Grouchinski wrote:
> 
> Please help...
> I need to issue a non-blocking request from
> event callback.
> This source is a skeleton for a gateway.
> It should read from one socket (via custom protocol) and talk to the rest of the world via HTTP. Any requests don't block and replies are processed as they come. The gateway should keep track what reply coresponds to a particular request.

As I mentioned in my previous mail, you will soon (like today or
tomorrow) be able to listen to sockets and handle incoming requests in
libwww for your special socket. Until then I would suggest that you have
a look at the sample app

	http://www.w3.org/Library/Examples/mget.c

as this tells you how to start libwww and make multiple, non blocking
requests.

As for how to register a separate open socket in the libwww event loop,
you create an event object as you have done. Then you start reading from
the socket and when you get a would block, you register that event as
pending for read. You will then get called back when the socket is
ready. The context is simply a pointer that will get passed along with
the callback - it is for you to use as you like.
  
Henrik

Received on Monday, 14 December 1998 09:34:14 UTC