HTTPServer single threaded?

  • Tim Malcolm

    Tim Malcolm - 2003-09-16

    Is the HTTPServer single threaded? And if it really is (which does appear to be the case), will making it multi-threaded "break" eventing, moderation, etc.?

    The reason I ask is that I'm implementing the AVTransport service of a UPnP Media Server, intend to add an HTTPRequestListener to the Media Server Device instance in order to "serve" Audio/Video content to various AVTransport instances.

    -- Tim.

    • Tim Malcolm

      Tim Malcolm - 2003-11-13

      Satoshi sent me a reply on 9/18, and said
      > Yes, the servers of HTTP and SSDP is single
      > thread version now.

      Here's a little multithreaded version of for anyone who's interested (not yet sent back to Satoshi). I'm doing fairly heavy network development and haven't had any issues with this so far! Note: it's not efficient - anyone want to change this to use thread pooling?

      -- Tim.

      public void run()
      if (isOpened() == false)

      Thread thisThread = Thread.currentThread();

      while (httpServerThread == thisThread) {
      final Socket sock;
      try {
      sock = accept();
      catch (Exception e){

      Thread runner = null;
      runner = new Thread(
      new Runnable() {
      public void run() {
      try {
      HTTPSocket httpSock = new HTTPSocket(sock);

      if ( == false)

      HTTPRequest httpReq = new HTTPRequest(httpSock);



      } catch (Exception ex) {
      } catch (Throwable ex) {


    • Satoshi Konno

      Satoshi Konno - 2003-12-15

      I changed to use multithreading about the HTTP server and release the package as v1.2. Please check it.

      I think the SSDP servers don't have use multithread because the receive buffer is so big for the SSDP packets and the SSDP messages have to synchronize.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks