Socket handling in Processing code?

edited May 2014 in How To...

Hi guys, I have a processing code and I want to use sockets to go with it. Do you know how to handle that i processing? I didn't see anything on the reference. The fact is, I want to have an online server using the javascript port (Javascript supports sockets), and two clients, one in java and other in android. Any idea of how I can connect the three with a socket relationship?

Answers

  • And all with processing code of course. And if it's not possible, please tell me how I should do it instead. Thank you very much

  • "socket" is a bit generic term. Do you mean WebSocket? HTTP Rest API?

    Hint: search for a Java solution, it will work in Processing.

  • websocket, yes, but it WILL be interpreted to Javascript if I write it in Java? Cause I know how to do that using the java.util.concurrent.SocketServer and Socket respectively, but I seriously doubt it will work, since they are java exclusive libraries.

  • I got it working with the accepted answer here, although the solution there is overly verbose — you don't need a lot of the Java boilerplate. You can implement clients and servers in Java/Processing or JavaScript, they'll talk to each other fine.

    I'm going to try and write up a tutorial for it but I'm not going to be able to do that for a couple of weeks at least.

  • Thx a lot

Sign In or Register to comment.