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!
 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.