My setup, I have an device (192.168.1.2) connecting to my WinBox (192.168.0.102) via ethernet. WinBox connects to LinBox (192.168.0.107) via WIFI.
On WinBox, I have installed cygwin and runs socat to redirect UDP traffic from localhost:3001 to device:3001. From LinBox, I run
cat ./temp/net_ping.bin| socat - UDP4-SENDTO:192.168.0.102:3001,reuseaddr > ./temp/response.bin
I got the expect response (from device) and save it into response.bin ok. However, when I issue the same command again, I see nothing happen. I checked cygwin terminal socat is still there. Here is the socat log for the two runs I just mentioned. We can see the first data exchanging was ok. Then it simple no further log for the second run.
$ socat -d -d -d UDP4-LISTEN:3001,reuseaddr,fork UDP4:192.168.1.2:3001
2024/01/10 20:39:28 socat[4108] I socat by Gerhard Rieger - see www.dest-unreach.org
2024/01/10 20:39:28 socat[4108] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2024/01/10 20:39:28 socat[4108] I This product includes software written by Tim Hudson ([email protected])
2024/01/10 20:39:28 socat[4108] I setting option "so-reuseaddr" to 1
2024/01/10 20:39:28 socat[4108] I setting option "fork" to 1
2024/01/10 20:39:28 socat[4108] I socket(2, 2, 17) -> 5
2024/01/10 20:39:28 socat[4108] N listening on UDP AF=2 0.0.0.0:3001
2024/01/10 20:39:35 socat[4108] N accepting UDP connection from AF=2 192.168.0.107:43718
2024/01/10 20:39:35 socat[4108] I permitting UDP connection from AF=2 192.168.0.107:43718
2024/01/10 20:39:35 socat[4108] N forked off child process 4628
2024/01/10 20:39:35 socat[4108] I close(5)
2024/01/10 20:39:35 socat[4628] I just born: child process 4628
2024/01/10 20:39:35 socat[4108] I socket(2, 2, 17) -> 5
2024/01/10 20:39:35 socat[4108] N listening on UDP AF=2 0.0.0.0:3001
2024/01/10 20:39:35 socat[4628] N opening connection to AF=2 192.168.1.2:3001
2024/01/10 20:39:35 socat[4628] I starting connect loop
2024/01/10 20:39:35 socat[4628] I socket(2, 2, 17) -> 6
2024/01/10 20:39:35 socat[4628] N successfully connected from local address AF=2 192.168.1.100:59993
2024/01/10 20:39:35 socat[4628] I resolved and opened all sock addresses
2024/01/10 20:39:35 socat[4628] N starting data transfer loop with FDs [5,5] and [6,6]
2024/01/10 20:39:35 socat[4628] I transferred 22 bytes from 5 to 6
2024/01/10 20:39:35 socat[4628] I transferred 22 bytes from 6 to 5
On WinBox, I start wireshark. When I run the sending comment for the second time, wireshark shows WIFI network adapter does receives the UDP package I send from LinBox. So it seems the socat session running inside cygwin simple stop working? Anyone has any idea what's wrong?