Reputation: 21
Hi i need to send udp packet with netcat without waiting for answer i tried with -w0 but something it bug and don't work
if you need this is my command :
echo 413055 | perl -ne 's/([0-9a-f]{2})/print chr hex $1/gie' | nc -4u -w0 192.168.111.247 8899
Upvotes: 2
Views: 9645
Reputation: 315
The arguments needed to exit immediately depend on which nc you have.
For GNU nc:
xxd -r -p <<<413055 | nc -uc 192.168.111.247 8899
For BSD or traditional nc, -q 0 does work:
xxd -r -p <<<413055 | nc -uq0 192.168.111.247 8899
See this related answer with more detail.
Upvotes: 0
Reputation: 1279
the wait option is -q (seconds):
echo 'test' | netcat -q 1 -u 192.168.111.247 8899
As is it wait a second and then quit. But it does not work with -q 0.
You could also try something like :
echo 'test' > /dev/udp/192.168.111.247/8899
Upvotes: 2