When you send binary data over the net, you have to send it in "network byte order", which means that any binary values larger than 8 bits/1 byte have to be ordered a specific way: Big-Endian, or what I call "Intel-hostile".

Rather than writing your own routines for it (which would likely not be portable to other platforms), use the sockets api calls which translate binary data to network byte order:

Use the WinSock unit, and the following functions to do the conversions:

ntohs() - network to host, short
ntohl() - network to host, long
htons() - host to network, short
htonl() - host to network, long

Then, it is just a matter of casting them as char arrays and concating them to your string.