I've read dozens of articles but still haven't found a working example. I want a web page to communicate with a remote device.
HTML5 Websockets will eventually be the easy solution. But not everything supports that yet.
XmlHttpRequest has the problem of refusing to communicate with a device not in the same domain.
PHP has stream_socket_client which I've actually had success with. However, if the communication gets messed up it doesn't seem to recover and I have to restart the web server to get it to unhang. (Remote device responds with a TCP/IP "Reset", indicating it isn't happy and wants to start over, but it doesn't seem to be happening on the PHP side.)
So, anyone know of any good examples sample working code that actually works and gets around all these little details that make the system not work?
Solution can be Ajax, XmlHttpRequest, PHP sockets, which I've only read I should use stream_socket_client and/or stream_socket_server instead.
Oh that reminds me, in addition to being able to initiate a connection with the remote device and talking to it, and also listening to it to receive any data it might want to send at any time; I also need the remote device to be able to initiate a connection to a server to send an email message or SMS text message whenever it wants to. (That's actually a separate issue I believe.)