Hi

I am trying to use the nsIChannel mechanism to access URI like data.

Here is what I do, (in brief I took this code from a presentation at
the
netlib(gecko) hoempabe at mozilla.org.
/////////////////BEGIN RELEVANT CODE
        const char* p_url = (const char*)arg;
    nsCOMPtr<nsIIOService>
ioserv(do_GetService("@mozilla.org/network/io-service;1") );
    nsCOMPtr<nsIURI> uri;
    nsCOMPtr<nsIChannel> chan;

    ioserv->NewURI
                (
                        nsDependentCString
                                (
                                        "http://localhost:8080/index.html";
                                ),
                        nsnull,
                        nsnull, 
                        getter_AddRefs(uri)
                );

    ioserv->NewChannelFromURI(uri,getter_AddRefs(chan));

        MyStreamListener msl;

    chan->AsyncOpen(&msl,nsnull);

        printf("Done open\n");

        //Wait for read-completion.
        msl.WaitForCompletion();
/////////////////END RELEVANT CODE

And MyStreamListener is just an almost dummy implemtation of
nsIStreamListener
interface that reurns NS_OK and does some debug dumping.

The behavior I have noticed with my code so far is that 

1/ "Done open" gets printed. 
2/ But after that nothing happens. None of the methods in
MyStreamListener are
apparently invoked (I get no debug output, art any rate).
3/ a netstat command indicates that TCP conections exist
4/ The program stays in this state.

Now , obviously I am missing something.

What do I need to do to "chug" the network engine on and get the data
out of my
URI?

With best regards
Chandra

Reply via email to