Created Wed Aug, 21 2019 at 04:38PM
You could run multiple instances of socat in the background in one command.
I use sleep N instead of socat ...N... ...N... for an example:
echo -n 1 2 3 | xargs -d ' ' -I% bash -c '(sleep % ; echo slept % ) &'
The () and the echo slept % part is only needed to have some example output, so your actual command would be simpler; % will be replaced by one of the port listed after echo:
echo -n 3392 3393 3394 | xargs -d ' ' -I% bash -c 'socat TCP4-LISTEN:%,fork TCP4:192.168.10.102:% &'
Wit the count of port args N, this should also work:
parallel -j N -i bash -c 'socat TCP4-LISTEN:{},fork TCP4:192.168.10.102:{}' -- 3392 3393 3394