7 Replies Latest reply on Mar 31, 2010 3:07 PM by Marc Autret

    Polling on Socket doesn't work+crash (ID CS3, JavaScript)


      Hello Everybody,


      after spending almost 2 days with trying to figure out what's going wrong I finally went crazy and gave up.


      All I want to do is using Sockets to write a little server app. When I use a (Client) Socket to request something from a server everything works as expected. But as soon as I use Sockets to poll for incoming connections the applications hang up and doesn't react anymore. This happens with all CS apps I have (Photoshop, InDesign, Bridge...).


      I used for example the following code: (taken from Adobe's JavaScript Tool Guide for CS3 (Direct link))

      conn = new Socket;
      // listen on port 1234
      if (conn.listen (1234)) {
      // wait forever for a connection
      var incoming;
      do incoming = conn.poll();
      while (incoming == null);
      // discard the request
      // Reply with a HTTP header
      incoming.writeln ("HTTP/1.0 200 OK");
      incoming.writeln ("Content-Type: text/html");
      // Transmit a dummy homepage
      incoming.writeln ("


      // done!
      delete incoming;


      When I drop netstat in the Terminal I see that while the script is running the port 1234 is opened. Make a connection to localhost:1234 with Firefox or Telnet the port/host is found and both are waiting for response data ... but nothing happens. --> Timeout.


      What do you think could be the reasons for that? I'd be damn thankful when somebody could give me a hint.


      Thanks in advance,




      P.S.: I'm not using a firewall or something else that could block the port.