[ENet-discuss] Basic PeerID question

LoneSock lonesock at gmail.com
Wed Jul 6 13:24:05 PDT 2005


This line works for me:

Peer_Index = (int)(event.peer - server->peers);

where I just got "event", and server is my "ENetHost *".

Jonathan



On 7/5/05, Darrell Bircsak <dbircsak at gmail.com> wrote:
> Howdy.  When you have created a server (host) with a peerCount of 32,
> for example, and then try to connect out to another host....
> 
> peer = enet_host_connect(server, &address, 1);
> 
> ...ENet will nicely pick an available peer from the 32.  I was
> wondering how do I know which one it picked?  Would I look at
> peer->incomingPeerID after a successful host_connect to get which peer
> it is in the server->peers array?
> 
> if (peer == server->peers[peer->incomingPeerID])
>      printf("Woo hoo!\n");
> 
> Is this the best way to do this...to use incomingPeerID?
> 
> Darrell
> 
> _______________________________________________
> ENet-discuss mailing list
> ENet-discuss at cubik.org
> http://lists.cubik.org/mailman/listinfo/enet-discuss
> 


-- 
Piranha are people too.



More information about the ENet-discuss mailing list