1 Reply Latest reply on Sep 27, 2011 7:38 AM by Bob Stucky

    ServerSocket in Photoshop: Allowing only one client to access the server at a time (ATTN BOB STUCKY)

    mlavie Level 1

      I have used Bob Stucky's excellent example of inter-process communication via SocketServer in a Photoshop Extension (written in ActionScript), in order to receive requests from another Adobe products for picture processing.

       

      The problem is that since there is only one Photoshop session openable at a time, I want to make sure that one client call doesn't interfere with the processing already in progress for a previous request. I.e., I want only one request to be processed at a time. How can I prevent other requests from interfering with the request already in progress? Can I accept a socket CONNECT event, but prevent it from actually doing anything until the previous request is done?

       

      Does someone have a better idea?

        • 1. Re: ServerSocket in Photoshop: Allowing only one client to access the server at a time (ATTN BOB STUCKY)
          Bob Stucky Adobe Employee

          I tested that issue, and while it does delay things a bit, running two calls at once doesn't cause a failure.

           

          Meanwhile, if you want to make it so that it will only work on one request at a time, I would modify the code, using an Array as a queue. When idle, I'd have a timer that checks the length of the queue every 10 seconds or so. Any time a call came in, I would set it in the queue. The timer handler picks up the call, stops the timer, deletes the call from the queue, runs the call & completes. Last step would be to check the queue; if the queue length == 0, reset the timer, else run the next call.

           

          Regards