> -----Oorspronkelijk bericht-----
> Van: [email protected] 
> [mailto:[email protected]] Namens David Lethe
> Verzonden: Tuesday, May 19, 2009 07:45
> Aan: [email protected]
> Onderwerp: [ENet-discuss] Differentiating multiple peer 
> clients from sameremote machines
> 
...

> So, how do I properly identify the individual peers running 
> on the remote systems when I get an ENET_EVENT_TYPE_CONNECT, 
> and use the The host is bound to ENET_HOST_ANY, at UDP port #4079.  

I use the following to uniquely identify client ID's in my QNClient
abstraction class:

    if(event.type==ENET_EVENT_TYPE_CONNECT)
    {
      if(peer)
      {
        // Already connected
        qinfo("QNClient: connect event but peer already connected, so drop
this one");
        enet_peer_disconnect(event.peer,0);
        enet_host_flush(host);
      } else
      {
        // No one connected yet; accept this one
        SetConnected(true);
        peer=event.peer;
        // Get a client ID from ENet internals - note the server is always
BASE_ID, so start one beyond that
        id=event.peer->outgoingPeerID;
        qinfo("QNClient: connected to server (our clientID=%d)",id);
      }

Hope that helps,
Ruud

_______________________________________________
ENet-discuss mailing list
[email protected]
http://lists.cubik.org/mailman/listinfo/enet-discuss

Reply via email to