Skip to content

Instantly share code, notes, and snippets.

@subtubes-io
Created August 16, 2016 03:58
Show Gist options
  • Save subtubes-io/8b61510a107dd40296e7398d12ec7e59 to your computer and use it in GitHub Desktop.
Save subtubes-io/8b61510a107dd40296e7398d12ec7e59 to your computer and use it in GitHub Desktop.
Push to UDP from linux
#!/usr/bin/env bash
# attribution to http://mikeberggren.com/post/53883822425/ncudp
echo -n “foo” | nc -4u -w1 <host> <udp port>
#Here’s quick breakdown of what’s happening:
#-n - Tells the echo command to not output the trailing newline.
#-4u Use IPV4 addresses only. Use UDP instead of TCP.
#-w1 Silently close the session after 1 second of idle time. That way, we’re not stuck waiting for more data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment