I am trying to use netcat to simulate a NAT traversal protocol.
I have one instance that is listening for UDP packets on port 6666, as so:
nc -ul 6666
In another terminal window, I am trying to periodically send a UDP packet from port 6666 (to open the return path on my router. this would be in a script that repeats every 20 seconds to re-open the port)
nc -u -p6666 mypinghost.com 4444
The problem is netcat fails on this ping call with the message:
nc: bind failed: Address already in use
Which implies that the listener having bound to port 6666 is blocking another process from sending from that port, or possibly that netcat is trying to bind to 6666 to listen.
Is this just how netcat is written, or can I tickle it some way to let me send a packet without binding to the port to listen?