Threaded Networking sample code

Discussion in 'Programmer Misc' started by Marc Stibane, Oct 1, 2008.

  1. Marc Stibane

    Marc Stibane Guest

    My code needs to run all networking routines in a separate NSThread. I
    have got a library, which I pass a callback routine for communication:

    my thread code
    library
    my callback (networking)
    library
    my thread code

    My callback routine must POST some data to an HTTP server
    (NSURLConnection), wait for the answer (start a NSRunLoop?), then return
    to the library.
    The library then processes the data. After the library returns to my
    thread, I can then post a notification to the main thread which handles
    drawing and user input.
    Is there any sample code covering how to use NSURLConnection in a
    NSThread?


    P.S. I just asked this question at stackoverflow also:
    http://stackoverflow.com/questions/157827/
     
    Marc Stibane, Oct 1, 2008
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.