UDP Hole Punching Timeout

I need to implement UDP protocol. The PC must listen on the dedicated UDP port for incoming packets. It also sends a packet (responses). The application works in Windows XP, 7, 8, ....

Windows Firewall blocks inbound packets. This can be bypassed by UDP holes. So I have to send something that should not hurt. But I want to worry as little as possible.

  • How to determine the timeout before the firewall closes the hole?
  • Can I detect that the firewall has closed the firewall so I have to resend it to open the package? Of course, I won’t get anything when the firewall is closed, but there may be other reasons for this.
+5
source share
3 answers

: -. , - Windows 7 UDP. -, .

:

  • . , .
  • , .
  • UDP-, . UDP. (9), , .
  • , . , , IP ARP MAC-. IP- ARP, IP-, . , .
  • , , .
+1

, netcat:

Unix (Mac OS X Darwin) ( Windows, Windows netcat "nc" UDP), UDP- , :

WINHOST=10.116.140.69
mkfifo f
nc -u -p 2222 $WINHOST 6666 < f | \
(while read secs; do for sec in $secs; do echo sleep $sec 1>&2; sleep $sec; echo SLEPT $sec; echo SLEPT $sec 1>&2; done; done) > f

Windows (64- Windows 7 Professional SP1) Windows, cygwin, netcat, UDP :

UNIXHOST=192.168.181.1
nc -u -p 6666 $UNIXHOST 2222

cygwin; Windows netcat , .

, , , , . : 1, 2, 10, 60, 120, 180. : 240. 180 240.

1: :

10
60
120
180
240

, - 180 240.

2: :

180
181
182
182

, - 181 , 182 .

3: ( ):

180 180 180 181 181 181 182 182 182 183 183 183

UDP , , 180, 181, 182 183 . , - 181 , , , ( ) 181 .

, , , .

:

  • 64- Windows 7 Professional SP1 UDP 181 . , , , , . , Windows 181 .
  • 64- Windows 7 Professional SP1, ( ), UDP 64 .

Windows .

+4

:

  • ( , Windows) IP-. /NAT , IP, IP-. - IP-, , .
  • / NAT. (, Windows), , / NAT, . Hardcoding , . , , , , /NAT , , , .
  • , , . NOP ( OPEA) KEEP_ALIVE, , , .

- KEEP_ALIVE, , KEEP_ALIVE . , IP- , KEEP_ALIVE. IP- , , . Windows COM API netsh, , . /NAT UPNP. , .

+2

All Articles