(this is to be solved in ANSI C, not really ANSI required but it'd be great not to get warnings with -Wall)
This program packs, sends and recieves Descriptors according to the Gnutella Protocol Specification...not really relevant, just read this struct for example:
I also calculate things like nfiles and nkbytes, and get port and ip as parameters. BUT some of these data I recieve or gather come as numeric data type (int...). So I haven't been able to pack the number into the string, and get it back as well. Moreover, as you see char* size is not necessarily 4 bytes (as int).Code:struct tpong { struct theader header; char port[2]; char ip[4]; char nfiles[4]; char nkbytes[4]; };
HELP!! Thx in advance!
Mariano Lopez-Gappa (20) from Argentina
EDIT: just a tiny comment: char vector lengths are not wrong since G.P.S. says not to save space for NULL terminators (so strlen, strcat, strcpy, strcmp is NO GOOD )