What do you mean clear a buffer?

There is

Code:
char szBuffer[32];

memset( szBuffer, 0, sizeof(buffer) / sizeof(char) );
or

Code:
char szBuffer[32];

ZeroMemory( szBuffer, sizeof(buffer) / sizeof(char) );
Basically the same thing...


and for your second question take a look at these fuctions: htons(), htonl(), ntohs(), ntohl()... They might help.