Menu

Piping to Server

2002-03-27
2002-04-01
  • Chris Shaffer

    Chris Shaffer - 2002-03-27

    Is it possible to "pipe" something to the server from a Java applet running on a client machine? 

    Imagine this:  A Java applet running on a client machine, with a scanner or barcode reader installed, interacts with the scanner, 'pipes' the UPC to the server, and somehow passes that number to the php process currently running.

    How difficult would this be to do?  How would the Java applet pass the scanned barcode to the correct php session that is currently running?

     
    • Tal Peer

      Tal Peer - 2002-03-27

      I think the applet should open a socket to the server and send it the UPC data, the server will parse it (if needed, i have no idea about it). The PHP app will open another socket to the server and get the parsed information. This should happen very fast on a LAN.

       
    • Chris Shaffer

      Chris Shaffer - 2002-03-27

      Does anyone here know how to open a PHP socket to listen for the TCP/IP packet from the client?  I guess if we could do that, then the Session ID # would also have to be included in the packet along witht the UPC to insure that the server was not responding to the UPC from another machine...

       
    • Joe White

      Joe White - 2002-03-27

      yeah its possible with java. You can listen to any socket or url with java. and to open a socket in php is fsockopen($server,$port). Might want to do something like
      $fp = fsockopen($server,$port) so you can see if $fp = true (Meaning its open)

       
    • Chris Shaffer

      Chris Shaffer - 2002-03-28

      So, if the Java applet running on the client machine was passed the UPC/SKU data from a scanner, we could append the PHP session ID number to it, and then pass that to the server.

      Does this sound doable?

       
    • Joe White

      Joe White - 2002-03-28

      We could make it so the constructor takes an inputstream and a sessionid. So when we pass it back we can just return the UPC/SKU and the session id.

       
    • John Mitchell

      John Mitchell - 2002-04-01

      Opening sockets is easy enough in PHP the main problem is that PHP was not designed to run as a deamon. PHP was designed to run as a script not as a program unfortunetly. I have seen it run as a deamon several times before, but all of them have been unstable.

       
    • Joe White

      Joe White - 2002-04-01

      Well Just for shits and giggles I wrote a servlet that listens to com or parallell ports. Its rather simple.

       

Log in to post a comment.