Any way to force a TCP connection to reset
-
I am trying to write software to communicate with some wireless LAN modules. Periodically, the device using the LAN module will power it up. It will then open a TCP connection to a server at a fixed IP address and port. Unfortunately, the WLAN module seems to pick the same source port number most of the time when it powers up. Under Windows 2000, if the WLAN module picks a port number YYYY that was used in an earlier connection, the packet sequence will be:
; End of previous connection
module.YYYY -> server.XXXX FIN+ACK
server.XXXX -> module.YYYY FIN+ACK
module.YYYY -> server.XXXX ACK
server.XXXX -> module.YYYY ACK
; Attempted new connection (PC doesn't know module got its ack)
module.YYYY -> server.XXXX SYN
server.XXXX -> module.YYYY ACK ; Not SYN ack, but rather a repeat of the previous ACK
module.YYYY -> server.XXXX RST+ACK ; Kill off old connection
module.YYYY -> server.XXXX SYN
server.XXXX -> module.YYYY SYN+ACK ; New connection is now happyWindows XP no longer sends the ACK after the SYN; the module will thus keep trying SYN packets until it times out. This causes many connections to fail. Is there any way using .net under XP to force the PC to reset a connection? Ideally, the WLAN module would simply pick different port numbers on each connection attempt, avoiding the problem altogether. Unfortunately, I have no control over the firmware for that thing.