recv() not workin fine.....

hi !

In my program I have a structure as shown below:
struct data
{
int a;
char *b;
long c;
}str;

i have assigned the following values to it:
strcpy(str.b,"John");
str.a=10;
str.c=123435;

The client is tryin to send struct data to the server using
send(sock,(char * )&str,sizeof(str),flag);

At the server side the data is read using the following:

recv(sock,(char *)&str,sizeof(str),flag);

but when i print the values on to the screen only the values of a and c get printed and b does not get printed.

The server also contains the structure.

i cant figure out y this is happening. any help is appreciated.

thanx

char *b;
reseves space a a pointer to a string. No space is reserved for the string itself. You need to use something like:
char b[30];
Now you have space for a 29 character string and a terminating null.

please anyone having the program of client server implementation server send messages to client ..please uploaded it ..