JeremyWA Posted January 7, 2014 Share Posted January 7, 2014 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! Quote Link to comment Share on other sites More sharing options...
requinix Posted January 7, 2014 Share Posted January 7, 2014 There are a few ways: * fsockopen/fwrite/fclose * socket_create/socket_sendto/socket_close * stream_socket_client/fwrite/fclose Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.