14

This is what I tried,but seems not working :

[root@ ~]# netstat -a|grep 48772
udp        0      0 *:48772                     *:*                                     
[root@ ~]# telnet localhost 48772
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host: Connection refused
yum
  • 569
  • 5
  • 9
  • 17

3 Answers3

18

You need to use netcat instead, telnet only supports tcp. Something like this will work:

$ nc -u localhost 48772

netcat is installed by default on most modern linux machines (assuming that's what you have).

Also for completeness sake I want to point out that there's another tool called socat which describes itself as 'netcat++'. Might be a good thing to check out. In general however netcat will do what you need just fine.

Phil Hollenback
  • 14,947
  • 4
  • 35
  • 52
16

You can use netcat instead:

nc -u localhost 48772

Eduardo Ivanec
  • 14,881
  • 1
  • 37
  • 43
5

Another option is to use socat:

$ socat - UDP:localhost:48772

which connects its standard input to port 48772 on localhost.

Conversely, to set up a server listening on UDP port 48772 that outputs to standard output:

$ socat UDP-RECV:48772 STDOUT

If the port is below 1024 then you need to run the listener as root or use sudo. socat can act as a relay (actually its primary purpose) where it accepts input on one port and outputs to another. Definately netcat++.

starfry
  • 591
  • 1
  • 7
  • 13