/* echo udp client - Usage: echoudp */ parse arg host . if ~show("L","rxsocket.library") then if ~addLib("rxsocket.library",0,-30) then do say "can't find rxsocket.library" exit end if host="" || host="?" then do say "Usage: echoudp " exit end addr = resolve(host) if addr=="-1" then do say "echoudp: no host <" || host || ">" exit end if ~GetServByName("SE","echo","udp") then do say "echoudp: no echo udp service" exit end remote.addrFamily = "INET" remote.addrAddr = addr remote.addrPort = se.servPort sock = socket("INET","DGRAM","IP") if sock<0 then do say "echoudp: no socket (" || errno() || ")" exit end local.addrFamily = "INET" local.addrAddr = 0 local.addrPort = 0 if bind(sock,"LOCAL")<0 then do say "echoudp: bind error (" || errno() || ")" exit end data = "echo udp service test" n = SendTo(sock,data,0,"REMOTE") if n