Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualrip-off

Posted 10 January 2013 - 10:31 AM

client code like this :

 

</p><div>   typedef struct _T{</div>
<div>        int id;</div>
<div>        char* testdata;</div>
<div>    }T, *PT;</div>
<div>    PT pt;</div>
<div>    memset(pt,0,sizeof(&pt));</div>
<div>    pt->id=1;</div>
<div>    pt->testdata="test datya";</div>
<div>    char pack[128];</div>
<div>    memcpy(&pack,pt,sizeof(&pt));    ////////////////////////////  pack got nothing???</div>
<div>    ENetPacket *packet=enet_packet_create((const void*)&pack,128,ENET_PACKET_FLAG_RELIABLE);</div>
<div>    if(NULL == packet){</div>
<div>        fprintf(stderr,"create packet with error\n");</div>
<div>        exit(EXIT_FAILURE);</div>
<div>    }</div>
<div> </div>
<div>    enet_peer_send(peer,0,packet);</div>
<div> </div>
<div>    enet_host_flush(client);</div>
<div>
 
but the server can';t  get anything ...? what wrong with it?

#1hsine

Posted 09 January 2013 - 09:57 AM

client code like this :

 

 

 

   typedef struct _T{
        int id;
        char* testdata;
    }T, *PT;
    PT pt;
    memset(pt,0,sizeof(&pt));
    pt->id=1;
    pt->testdata="test datya";
    char pack[128];
    memcpy(&pack,pt,sizeof(&pt));    ////////////////////////////  pack got nothing???
    ENetPacket *packet=enet_packet_create((const void*)&pack,128,ENET_PACKET_FLAG_RELIABLE);
    if(NULL == packet){
        fprintf(stderr,"create packet with error\n");
        exit(EXIT_FAILURE);
    }
 
    enet_peer_send(peer,0,packet);
 
    enet_host_flush(client);
 
 
but the server can';t  get anything ...? what wrong with it?

PARTNERS