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! Link to comment https://forums.phpfreaks.com/topic/285173-php-sending-time-sensitive-non-critical-data-to-desktop-computer/ 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 Link to comment https://forums.phpfreaks.com/topic/285173-php-sending-time-sensitive-non-critical-data-to-desktop-computer/#findComment-1464318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.