From one Terminal:

echo "test" | nc -u -l 10000

From another Terminal:

nc -u 10000

But the Terminal just hangs, it doesnt return the "test" output. It seems to work fine without the -u argument. What am I getting wrong here?


You seem to have accidentially reversed which one is the listener and which one is not. I.e. you'll need to change the commands to the following:

Open the listener first:

nc -u -l 10000

Then the sender:

echo "test" | nc -u 10000

Then you'll see that the listener outputs "test" on the console.

You can stop the nc program by pressing Ctrl-c.

  • Thanks, this works. Strangely, if you use localhost instead of nothing happens. – Sridhar Sarnobat Aug 27 at 21:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .