Naveen wrote:

> I would like to use netlib as a library in one of our server components, I
> just some doubts abt the library like
> 1. Can u we use it as a standalone. Is it a lot of work to use that as a
> standalone?

netlib (necko) is broken into two mozilla components: necko.so (core 
networking pieces along with primary protocols, such as HTTP, FILE, and 
JAR) and necko2.so (secondary protocols, such as FTP and FINGER).

netlib requires NSPR, XPCOM, and libjar.  XPCOM has its own requirements 
that you should be aware of.

currently, we don't have binary distributions of just these components.  
this is something we are hoping to do in the near future.

what you should do is get a mozilla build (mozilla 0.7 for example) and 
a copy of the distribution headers.  you'll have to pull out the 
components you need to use.  i would suggest that you talk to people on 
n.p.m.xpcom about what you need in order to use XPCOM outside of 
mozilla.  you might want to check out what is happening with 
protozilla... it uses necko as well.


http://protozilla.mozdev.org/

> 
> 2. Is the library multithreaded , i.e can we have multiple HTTP, FTP
> downloads at the same time.


portions of necko are multithreaded (thread-safe).  however, HTTP and 
FTP currently are not thread-safe.  they expect to be called from one 
thread.  this does not preclude having multiple HTTP and FTP downloads 
at the same time, as all processing is event based.

take a look at the nsIChannel interface.  the method asyncRead triggers, 
for example, an HTTP transaction.  data is fed chunk-by-chunk to the 
caller via the nsIStreamListener interface passed to asyncRead.  the 
listener's onDataAvailable method is called when a chunk of  data is 
made available.  in this way clients of necko can process multiple 
requests little by little in an asynchronous fashion.

ultimately, though, HTTP and probably FTP will be made thread-safe, 
allowing separate threads to call asyncRead.

> 
> Any help will be appreciated.
> 
> Thank you in advance.
> 
> 
you are welcome.

darin


Reply via email to