<div dir="ltr">Hi,<div><br></div><div>That is correct, it's on the client side. Let me answer this a little less quickly: in my client class I have:</div><div><br></div><div><div>if(event.type==ENET_EVENT_TYPE_CONNECT)</div><div>...</div><div>        // Get a client ID from ENet internals<br></div><div>        id=event.peer->outgoingPeerID+QNServer::BASE_ID;</div></div><div><br></div><div>(I actually use an offset to avoid using the 'id' as an offset in array; they should be id's, not indices if you get a little more complex)</div><div><br></div><div>In the server class indeed I use 'incomingPeerID' to store information about the client:</div><div><br></div><div>

<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">if(event.type==ENET_EVENT_TYPE_CONNECT)</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">...</div><div>      // Add client to this server</div><div>      Client *c=&client[clients-1];<br></div>      c->id=event.peer->incomingPeerID+QNServer::BASE_ID;<br></div><div><br></div><div>Cheers,</div><div>Ruud</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 2, 2018 at 5:27 PM, shinyclaw <span dir="ltr"><<a href="mailto:shinyclaw@op.pl" target="_blank">shinyclaw@op.pl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Thanks Ruud, I assume that this is the case on the client side? On the server side, it should be event.peer->incomingPeerID?</div><div class="HOEnZb"><div class="h5">
<div> </div>
<div>W dniu 2018-03-02 16:29:36 użytkownik Ruud van Gaal <<a href="mailto:ruud@racer.nl" target="_blank">ruud@racer.nl</a>> napisał:</div>
<blockquote style="margin-left:7px;border-left:2px solid orange;padding-left:8px">
<div dir="ltr">I use event.peer->outgoingPeerID.
<div> </div>
<div>Ruud</div>
</div>
<div><br>
<div>On Fri, Mar 2, 2018 at 2:23 PM, shinyclaw <span dir="ltr"><<a href="mailto:shinyclaw@op.pl" target="_blank">shinyclaw@op.pl</a>></span> wrote:<br>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all, I'm trying to write a simple client-server game using ENet. I have a small problem with client's identification using enet_host_service() method. Each new client that connects to the server should have a unique netID, so later the server knows who is talking to him. But how can I achieve that? On the server, when receiving ENET_EVENT_TYPE_CONNECT event should I assign event.peer to newly created GameObject? Or use event.peer->outgoingPeerID or incomingPeerID? Or peer.sessionID? Or something else? Thanks for any help!<br> <br> ______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.cubik.org/<wbr>mailman/listinfo/enet-discuss</a></blockquote>
</div>
</div>
</blockquote>
<div> </div>
</div></div><br>______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.cubik.org/<wbr>mailman/listinfo/enet-discuss</a><br>
<br></blockquote></div><br></div>