We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Connecting Two Processing Sketches via Web
Page Index Toggle Pages: 1
Connecting Two Processing Sketches via Web (Read 1991 times)
Connecting Two Processing Sketches via Web
Oct 3rd, 2009, 6:27am
 
Hello,
I'm starting a new project and would like to connect two processing applets together via remote locations. I've done a fair bit of research but just wondered if anybody else has come across this in the past The difficulty I'm finding is getting the two to find each others respective ip addresses. The best way I can see to do this is using my web host to create details of the two sketch's ip adresses. However I can't find a way to easily upload the data to my web space (it's not a fixed IP).
I'm looking into some kind of php, mySQL, XML type solution at the moment.
I've been looking at this -
http://www.tigoe.net/pcomp/code/category/PHP/377#more-377
although this only seems to get, not put information into the XML file.
Has anybody got any tips

Thanks,
Tim
Re: Connecting Two Processing Sketches via Web
Reply #1 - Nov 30th, 2009, 10:09pm
 
You have a few options when using PHP, but the right one depends on your hosting environment. If you have access to the semaphore (eg. the msg_get_queue function) or shared memory (eg. the shm_get_var function) functions, try them.

Otherwise, you can get away with some shared file trickery. As long as you are careful you can use the flock() function to lock a shared file when reading/writing data. Each script can keep track of offset of the last thing they read in the file in a cookie/session. You can even automatically do file cleanup when it gets too large.

If you expect few writes, and mostly reads, you can skip tracking file offsets and just have each write add another file in a series (possibly named by timestamp).
Re: Connecting Two Processing Sketches via Web
Reply #2 - May 7th, 2010, 4:51am
 
Thank you for your reply. I'm afraid I didn't find it until yesterday!
The project that I was doing with this has been put on the back-burner for now in favour of a simpler project that I'm going to submit for my university final project. This information will be used sometime in the future I hope as I'm interested in pursuing my old project.

Thank you for your information, I'm sure it'll prove useful soon!

Tim
Page Index Toggle Pages: 1