Both hosts should try to send to one another at the same time from/to predefined ports.<br><br><a href="https://en.wikipedia.org/wiki/UDP_hole_punching">https://en.wikipedia.org/wiki/UDP_hole_punching</a><br><br><br><br><br>
<div class="gmail_quote">On Tue, Sep 18, 2012 at 11:24 AM, Martin Zemblowski <span dir="ltr"><<a href="mailto:martin@bigheadgames.co.uk" target="_blank">martin@bigheadgames.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>gamespy transport service is using udp.
      <br>
      right now one of the player creates socket and just listens to it,
      another on is actively trying to connect to other party, but fails
      at create_host for some reasons. I am creating host in the same
      way on both machines.<br>
      <br>
      I am testing connectivity on the same machines constantly, so I
      dont see any reason why it should work for 3 times in a row and
      then wouldnt... and it's a bit weird moment - creating host, i
      would expect it to fail when actually trying to connect<br>
      :(<div><div class="h5"><br>
      <br>
      <br>
      On 18/09/2012 16:16, Daniel Aquino wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">Is gamespy using tcp or udp ?<br>
      <br>
      If both your players try to connect at the same time then they
      should get through after a retry or two.<br>
      <br>
      Although there is many types of nat's so it might not always work.<br>
      <br>
      <br>
      <br>
      <div class="gmail_quote">On Tue, Sep 18, 2012 at 10:37 AM, Martin
        Zemblowski <span dir="ltr"><<a href="mailto:martin@bigheadgames.co.uk" target="_blank">martin@bigheadgames.co.uk</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div>
            <div>
              <div bgcolor="#FFFFFF" text="#000000">
                <div style="font-family:-moz-fixed;font-size:14px" lang="x-western">Hello! <br>
                  I am using enet library in conjunction with gamespy. I
                  use gamespy to create socket, connect to lobby, select
                  opponent and do the NAT punch-through. In next step I
                  close gamespy socket, initialize enet library and try
                  to create enet host with same port (in my case I pass
                  ip as empty string) and then start connection to other
                  party. It works, but not always. I am using three
                  computers right now: pc vista, pc xp and mac osx
                  10.7.4. On mac sometimes (not always) I cannot create
                  enet host (even if i try to create host with different
                  ports, 100 retries), here's the code: <br>
                  <br>
                  retries = 101; <br>
                  enet_address_set_host (&enet.gAddress, ip); <br>
                  do    { <br>
                      enet.gAddress.port = port; <br>
                      enet.gHost = enet_host_create (&enet.gAddress
                  , 1 , 2, 0 ,0 ); <br>
                  <br>
                      if (enet.gHost == NULL) <br>
                      { <br>
                          printf ( "An error occurred while trying to
                  create an ENet host(%s:%d).\n",ip,port); <br>
                          port++; // HACK <br>
                      } <br>
                      else <br>
                          printf( "host created.\n"); <br>
                      } while (enet.gHost == NULL && (--retries
                  > 0)); <br>
                  <br>
                  Any ideas? <br>
                  Thank you! <br>
                  Martin <br>
                  <br>
                </div>
              </div>
            </div>
          </div>
          <br>
          _______________________________________________<br>
          ENet-discuss mailing list<br>
          <a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
          <a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
          <br>
        </blockquote>
      </div>
      <br>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
ENet-discuss mailing list
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br>