[R] Writing to a UDP server from R?

Warren Young warren at etr-usa.com
Tue Jul 28 01:15:15 CEST 2009


Saptarshi Guha wrote:
> 
> This does not work
>  u <-  socketConnection('localhost',9000)

UDP and TCP are entirely different worlds.  They don't share the same 
port space; TCP port 9000 and UDP port 9000 are different things.  Plus, 
UDP is connectionless, so you can't "connect" to a UDP port.  All you 
can do is throw packets at a server, which may or may not be listening 
for those packets.

You will either have to rely on an external program to do the UDP 
communication for you, or write an extension to R to provide this 
functionality.

Suitable helper programs are 'nc' and 'ncat'.  nc is abandonware, so the 
nmap folk built their own version of the same idea and added it to nmap 
v5.  nmap v5 is very new, though, so you might have nc on your system 
already, but and old version of nmap, and prefer to use the defunct 
program rather than upgrade your nmap.




More information about the R-help mailing list