- From: Richard Atterer <richard@list03.atterer.net>
- Date: Mon, 24 Feb 2003 20:26:09 +0100
- To: jd sw <jdsw2002@yahoo.com>
- Cc: www-lib@w3.org
On Sun, Feb 23, 2003 at 12:18:29AM -0800, jd sw wrote: > A. Can libwww be used in a multithreaded program ? Which portions of the > library are thread safe ? libwww is not thread safe - if your application is multithreaded, you'll have to take care that only one thread accesses it. However, libwww allows multiple simultaneous downloads - its event loop can call select() to wait for something to happen with any one out of several sockets. This event loop model happens to fit well into the event loop model of graphical toolkits like GTK+. For GTK+, there's even "glibwww", which integrates the libwww event loop into the glib event loop. > B. How does one go about simulating multiple http clients (browser like) > in the same process where cookies, cache etc are kept separate each > "client". Keeping track of the different clients' state would be your application's job - with libwww, you can start requests and attach extra headers (cookies, user-agent etc.) I think libwww's cache does not allow such a separation (I could be wrong), but you can just not use the cache. BTW, the biggest problem of libwww for new users is probably that it seems so bloated and behaves in strange ways sometimes. For this reason, expect to be forced to have a look at its sources from time to time. If you want a thread safe library which is similar to libwww and much cleaner, have a look at libcurl. However, libcurl does not support HTTP pipelining. HTH, Richard -- __ _ |_) /| Richard Atterer | CS student at the Technische | GnuPG key: | \/¯| http://atterer.net | Universität München, Germany | 0x888354F7 ¯ '` ¯
Received on Monday, 24 February 2003 15:14:25 UTC