Witam pisze klienta gadu-gadu na protokole 7.7 pojawil sie problem przy odbieraniu wiadomosci, gdy ktos zmienia status, pisze do mnie, wysyla obrazek czy cos jeszcze, dostaje pakiet 6001c8
struct gg_header
{
int type;
int length;
}typedef GG_HEADER;
#define GG_RECV_MSG 0x00a
struct gg_recv_msg
{
int sender;
int seq;
int time;
int class;
char message[1890];
}typedef GG_RECV;
int last_type=0;
int last_len=0;
main..
{
int ret = OrgRecv(sock, data, count, sth);
if(ret > 0)
{
if(ret==8)
{
GG_HEADER ggh;
strncpy((char *)&ggh, (char *)&data, count);
last_type=ggh.type;
last_len=ggh.length;
//MessageBox(NULL,(char*)last_type,"alert",MB_OK);
char xx[15];
sprintf(xx,"type: %x",last_type);
MessageBox(NULL,xx,"if",MB_OK);
}else
{
char xx[15];
sprintf(xx,"type: %x",last_type);
MessageBox(NULL,xx,"else",MB_OK);
if(last_type == GG_RECV_MSG)
{
MessageBox(NULL,"lola","alert",MB_OK);
GG_RECV ggr;
strncpy((char *)&ggr, (char *)&data, last_len);
MessageBox(NULL,ggr.message,"alert",MB_OK);
}
last_type=0;
last_len=0;
}
}
return ret;
}
oczywiscie kawlek kodu jest odpowiednio zapetlony zeby odbierac 2 czesc pakietu