I'd spent hours with Google trying to find how to control a separate software package from R via a UDP interface (I could run the package under a "system" command, but that was too slow). I finally figured out a way to communicate with UDP through R, and it works fine (using the "system" command) - it's also fast.

(1) install software "socat" (available on most of the Linux repositories). It's potent software for communication stuff, btw.

(2) set up the UDP 'port' to communicate with (like in a separate software package for passing commands and responses back and forth).

(3) use the "system" command to send messages - as an example:
system("echo \"quit\"| socat - UDP4-DATAGRAM:0.0.0.0:19004")

I haven't tried receiving data from that software yet... but according to the writeup on socat, it should be no problem. You can also use the socat software to redirect from one type of connection to another.

(I'm studying R - both for programming/running 'real world' interfaces and then doing the statistics on the data.)

Hope this helps someone - the (tiny) few messages I've found indicated that it couldn't be done (they were old). It can be done and rather simply.

Bob

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to