The fundamental thing you need to do is just have code on one side that knows how to serialize data, and code on the other that knows how to deserialize.
So, for variable length strings, just send the length first:
n = strlen(playerid) + 1; // for NULL terminator
and then on the receiving side get the length, and read that many bytes.:
s = malloc(n)
Of course, what you should really do is gather up your communication into packets, and then send blocks of data at once with headers, have type info in a debug mode for safety, etc. but that's the gist of it.
Google protocol buffers look like they are a way of turning data into something serializable, so in that version of this example send and recv would be an XML string, which is great for general servers, but you may want more explicit control.