parsing problem

answerme's Avatar, Join Date: Dec 2007
Ambitious contributor
Iam facing parsing problem .I have 2 bytes of data my_message. & i want to send this data to client (socket proging).Server side my parsing is ok ,but on client side its getting wrong
Code below:
Server Side
char buff[10];
int my_byte=129;
buff[0]=(my_byte & 0xff)>>8;
buff[1]=(my_byte & 0xff);
send(sock, buffstrlen(buff), 0);

Client Side
char recv_data[10];   	
my_byte=(recv_data[0]& 0xff)|(recv_data[1] & 0xff)>>8;
xpi0t0s's Avatar, Join Date: Aug 2004
buff[0]=(my_byte & 0xff)>>8;
OK, so what value do you think XY will have if you zero out X then shift it right by 8 bits (thus obliterating Y)?

> Server side my parsing is ok

And that's why you can't find the problem. NEVER assume the problem "isn't" in a particular location. You have to get that information from analysis of the root cause AFTER you have found it.