socat as a multi-client UDP proxy on macOS?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm trying to use socat as a UDP proxy (v4->v6) for a client (game) which routinely initiates new UDP "connections" (TL;DR - the world runs on multiple servers listening on different UDP ports, client stays connected to 1 particular server, and will need to connect to another, as the player travels between world layers). As I understand the manual, the "fork" option should take care of this, keeping the listening socket in the parent process and forking off children bound to specific "remote" address + port:
$ socat UDP4-LISTEN:11001,bind=127.0.0.1,fork,reuseport,reuseaddr UDP6-SENDTO:remotehost:11001
(repeated for port 11000)
So far, so good:
$ lsof -P -i 4UDP -a -p $(pgrep -d, socat)
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 2990 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001
socat 2991 myxal 5u IPv4 0x4e6e342add345f2f 0t0 UDP localhost:11000
But when I actually do this and run the client, the parent that should reopen the listening socket fails with "Address already in use":
socat[2990] E bind(5, LEN=16 AF=2 127.0.0.1:11001, 16): Address already in use
Of course, lsof
confirms there's nothing listening on that socket:
$ lsof -P -i 4UDP:11001
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 3105 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001->localhost:57324
I can even run nc -u -l 11001
at this point without issue. What am I missing here?
EDIT: I'm starting to think the command above is technically correct, and I'm seeing a bug in socat. ATM, I'm working around the issue by simply launching socat in a loop - the children which hold the connected socket, are unaffected, after all...
while true; do sleep 1; socat [...] ;
networking osx proxy socat
add a comment |Â
up vote
0
down vote
favorite
I'm trying to use socat as a UDP proxy (v4->v6) for a client (game) which routinely initiates new UDP "connections" (TL;DR - the world runs on multiple servers listening on different UDP ports, client stays connected to 1 particular server, and will need to connect to another, as the player travels between world layers). As I understand the manual, the "fork" option should take care of this, keeping the listening socket in the parent process and forking off children bound to specific "remote" address + port:
$ socat UDP4-LISTEN:11001,bind=127.0.0.1,fork,reuseport,reuseaddr UDP6-SENDTO:remotehost:11001
(repeated for port 11000)
So far, so good:
$ lsof -P -i 4UDP -a -p $(pgrep -d, socat)
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 2990 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001
socat 2991 myxal 5u IPv4 0x4e6e342add345f2f 0t0 UDP localhost:11000
But when I actually do this and run the client, the parent that should reopen the listening socket fails with "Address already in use":
socat[2990] E bind(5, LEN=16 AF=2 127.0.0.1:11001, 16): Address already in use
Of course, lsof
confirms there's nothing listening on that socket:
$ lsof -P -i 4UDP:11001
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 3105 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001->localhost:57324
I can even run nc -u -l 11001
at this point without issue. What am I missing here?
EDIT: I'm starting to think the command above is technically correct, and I'm seeing a bug in socat. ATM, I'm working around the issue by simply launching socat in a loop - the children which hold the connected socket, are unaffected, after all...
while true; do sleep 1; socat [...] ;
networking osx proxy socat
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm trying to use socat as a UDP proxy (v4->v6) for a client (game) which routinely initiates new UDP "connections" (TL;DR - the world runs on multiple servers listening on different UDP ports, client stays connected to 1 particular server, and will need to connect to another, as the player travels between world layers). As I understand the manual, the "fork" option should take care of this, keeping the listening socket in the parent process and forking off children bound to specific "remote" address + port:
$ socat UDP4-LISTEN:11001,bind=127.0.0.1,fork,reuseport,reuseaddr UDP6-SENDTO:remotehost:11001
(repeated for port 11000)
So far, so good:
$ lsof -P -i 4UDP -a -p $(pgrep -d, socat)
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 2990 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001
socat 2991 myxal 5u IPv4 0x4e6e342add345f2f 0t0 UDP localhost:11000
But when I actually do this and run the client, the parent that should reopen the listening socket fails with "Address already in use":
socat[2990] E bind(5, LEN=16 AF=2 127.0.0.1:11001, 16): Address already in use
Of course, lsof
confirms there's nothing listening on that socket:
$ lsof -P -i 4UDP:11001
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 3105 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001->localhost:57324
I can even run nc -u -l 11001
at this point without issue. What am I missing here?
EDIT: I'm starting to think the command above is technically correct, and I'm seeing a bug in socat. ATM, I'm working around the issue by simply launching socat in a loop - the children which hold the connected socket, are unaffected, after all...
while true; do sleep 1; socat [...] ;
networking osx proxy socat
I'm trying to use socat as a UDP proxy (v4->v6) for a client (game) which routinely initiates new UDP "connections" (TL;DR - the world runs on multiple servers listening on different UDP ports, client stays connected to 1 particular server, and will need to connect to another, as the player travels between world layers). As I understand the manual, the "fork" option should take care of this, keeping the listening socket in the parent process and forking off children bound to specific "remote" address + port:
$ socat UDP4-LISTEN:11001,bind=127.0.0.1,fork,reuseport,reuseaddr UDP6-SENDTO:remotehost:11001
(repeated for port 11000)
So far, so good:
$ lsof -P -i 4UDP -a -p $(pgrep -d, socat)
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 2990 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001
socat 2991 myxal 5u IPv4 0x4e6e342add345f2f 0t0 UDP localhost:11000
But when I actually do this and run the client, the parent that should reopen the listening socket fails with "Address already in use":
socat[2990] E bind(5, LEN=16 AF=2 127.0.0.1:11001, 16): Address already in use
Of course, lsof
confirms there's nothing listening on that socket:
$ lsof -P -i 4UDP:11001
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
socat 3105 myxal 5u IPv4 0x4e6e342add34664f 0t0 UDP localhost:11001->localhost:57324
I can even run nc -u -l 11001
at this point without issue. What am I missing here?
EDIT: I'm starting to think the command above is technically correct, and I'm seeing a bug in socat. ATM, I'm working around the issue by simply launching socat in a loop - the children which hold the connected socket, are unaffected, after all...
while true; do sleep 1; socat [...] ;
networking osx proxy socat
edited Mar 31 at 19:39
asked Mar 31 at 12:31
myxal
286
286
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f434664%2fsocat-as-a-multi-client-udp-proxy-on-macos%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password