I'd like to use socat as a relay to let two players (both behind firewalls) of my game connect to each other. The game engine uses UDP. Player A will host the game server, player B will join as client, the public server C will just act as relay for the traffic.
I'm currently trying to setup a test scenario all on my local box. An analogous test case with TCP worked just fine, but I'm stuck on the UDP case.
- (A) UDP echo server:
sudo nc -ul ::1 1234
- (C) Start relay:
socat -d -d UDP6-LISTEN:33000 UDP6-LISTEN:22000
- (A) Connect echo server to relay:
socat -d -d UDP6:ip6-localhost:33000 UDP6:ip6-localhost:1234
- (B) Connect as client:
nc -uvvv ::1 22000
It seems that C doesn't ever start listening on 22000 (with TCP this happened as soon as A connects the echo server to the relay). And therefore B can't connect on 22000.
Output of C:
$ socat -d -d UDP6-LISTEN:33000,bind=ip6-localhost UDP6-LISTEN:22000,bind=ip6-localhost
2019/06/02 15:42:49 socat[15422] N listening on UDP AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:33000
Output of A:
$ socat -d -d UDP6:ip6-localhost:33000 UDP6:ip6-localhost:1234
2019/06/02 15:43:05 socat[15436] N opening connection to AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:33000
2019/06/02 15:43:05 socat[15436] N successfully connected from local address AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:34270
2019/06/02 15:43:05 socat[15436] N opening connection to AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:1234
2019/06/02 15:43:05 socat[15436] N successfully connected from local address AF=10 [0000:0000:0000:0000:0000:0000:0000:0001]:47053
2019/06/02 15:43:05 socat[15436] N starting data transfer loop with FDs [5,5] and [6,6]
B doesn't really produce any output:
$ nc -uvvv ip6-localhost 22000
$
I'm sure I must be making some very basic mistake. Thanks in advance for any insight you can provide.