[ENet-discuss] Problem partailly solved
Alexaroth
alex_prislopeanu at yahoo.com
Mon Feb 28 03:32:50 PST 2011
Well I kinda understand how things work... the thing is this
I have some client code:
peer = enet_host_connect (client, & address, 2, 0);
name = player.getname(); //this returns a string from inside a class member
peer->data = (void*)name.c_str(); I am making the peer data the name of the player
On the server end:
ENetPeer *peer2[2];
while (enet_host_service (server, & event, 100) > 0)
{ switch (event.type)
{
case ENET_EVENT_TYPE_CONNECT:
peer2[1] = event.peer;
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
name=(char*)peer->data;
....
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 .
So my question... shouldn't event.peer have the data that the client has set ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubik.org/pipermail/enet-discuss/attachments/20110228/b7fe8d24/attachment.html>
More information about the ENet-discuss
mailing list