Jump to content

PHP sending time sensitive, non-critical data to desktop computer


JeremyWA

Recommended Posts

I'd like to send small bits of data from my web server to a desktop computer (Raspberry Pi) configured to listen to this data using Python.

 

This data should be sent in real-time but the information is not critical; the computer either gets it or it doesn't. I don't want my site to hang if it is having any type of connection error, such as if the computer is turned off.

 

 

I'm thinking sending a UDP message might be the best approach, but I'm curious how to configure it for PHP:

 

PsudoDbQuery('insert stuff into table');

...

$desktopIpAddress = 'w.x.y.z';

$portNumber = '4321';

$data = 'f03';

fwrite(fsockopen('udp://'.$desktopIpAddress, $portNumber), $data);
...
echo 'You created a new profile';
 
Would an fwrite using fscockopen be a good approach? Should I do anything differently? Thanks!
 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.