The data that peer->data has is application-specific for your active application. What this means is, you can't share it since there's no way for ENet to know e.g., how many bytes you set, and it isn't transmitted by ENet. It's merely a way to provide user data to the peer while you're working with peers on ENet (this way you dont have to use a secondary mechanism to find a peer by ENetPeer *).<br>
<br>So after you get connected, you should send a packet specifying the player's name (best to send a Reliable packet in this case) or something similar.<br><br><div class="gmail_quote">On Mon, Feb 28, 2011 at 11:32 AM, Alexaroth <span dir="ltr"><<a href="mailto:alex_prislopeanu@yahoo.com">alex_prislopeanu@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div style="color:#000;font-size:14pt"><div>Well I kinda understand how things work... the thing is this</div><div>
<br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">I have some client code:</div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
<br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">peer = enet_host_connect (client, & address, 2, 0);<br></div>
<div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">name = 
 player.getname();    //this returns a string from inside a class member<br>peer->data = (void*)name.c_str();  I am making the peer data the name of the player</div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
<br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal"><br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
On the server end: <br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal"><br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
ENetPeer *peer2[2];</div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal"><br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
while (enet_host_service (server, & event, 100) > 0)<br>    {   switch (event.type)<br>        {</div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
        case ENET_EVENT_TYPE_CONNECT:              <br><br>            peer2[1] =
 event.peer;    <br>            textprintf_ex(screen, font, 10, 200, white,-1,"%s is client !",peer2[1]->data);   this is allegro, it just outputs the %s is client on screen<br>            name=(char*)peer->data;<br>
   ....</div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal"><br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
<br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">The problem is that this crashes when it tries to output the peer2[1]->data . When debugging I
 checked to see if the peer2[1].data changes to whatever the client has set it but its just 0x000000 . <br></div><div style="color:rgb(0, 0, 0);font-size:18.6667px;font-family:times new roman,new york,times,serif;background-color:transparent;font-style:normal">
So my q<span>uestion... shouldn't event.peer have the data that the client has set ? <br></span></div></div><br>

      </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>