2 Replies Latest reply on Feb 1, 2012 11:03 AM by bduffy323

    Socket issues

    bduffy323 Level 1

      I have a pretty standard http request call where I am trying to return xml to indesign to parse. When I go to the url in my browser I am printing exactly what I want to return to indesign via the socket. However, sometimes I am getting a rtnData of "" which is of length 0 and sometimes I am getting a return data of  my xml which is of length of about 183,000. Can anyone think of anything that may be causing this? I'm using CS5.5.


      var rtnData = "";

      var conn = new Socket;





                var myRequest = "GET "+vSubDir+"/indesign/"+myfilename+" HTTP/1.0\n\n";


          if (conn.open (vHost)) // access


              conn.write (myRequest);       // send a HTTP request



              rtnData = conn.read(999999);  // and read the server’s reply








      *I'm guessing maybe it is a time out issue? How long does conn.read(999999) wait for a response?

        • 1. Re: Socket issues
          John Hawkinson Level 5

          Do you have access to the server logs?

          What platform are you on? Perhaps you're better off using a more mature HTTP library/tool.

          The default timeout is 10 seconds. You can try setting conn.timeout=60; or somesuch before you open the connection.

          • 2. Re: Socket issues
            bduffy323 Level 1

            Ahh that will do it! I timed how long my call was taking and it was 11 seconds, and then sometimes it was 9.8 seconds so it would work it seemed at random pending on the network speed at that time! How frustrating! But since I set the timeout to 60 seconds it seems to be working 100% of the time. Thank you!