Search code examples
windowslinuxsshdnssocat

How to stop socat from quitting?


I am using socat for windows as a client to tunnel DNS over SSH, it works perfectly until the ssh connection dies or becomes temporarily unavailable - when this happens the socat windows client terminates and requires restarting.

I am using the following command on windows client:

socat -s udp-recvfrom:53,reuseaddr,bind=127.0.0.1,fork tcp:127.0.0.1:5377

Does anyone know a way to prevent the socat client from quitting when the ssh connection becomes unavailable? The help file suggests the -s switch solves this but it doesn't.


Solution

  • Following your comment, a loop in VBScript (what Windows Scripting Host uses) is easier:

    Do
        WshShell.Run "socat.exe -s udp-recvfrom:53,reuseaddr,bind=127.0.0.1,fork tcp:127.0.0.1:5377",0,True
    Loop While True