socat as a multi-client UDP proxy on macOS?

The name of the pictureThe name of the pictureThe name of the pictureClash 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 [...] ;






share|improve this question


























    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 [...] ;






    share|improve this question
























      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 [...] ;






      share|improve this question














      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 [...] ;








      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 31 at 19:39

























      asked Mar 31 at 12:31









      myxal

      286




      286

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          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



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes










           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Bahrain

          Postfix configuration issue with fips on centos 7; mailgun relay