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
sendto(server_sock,&n,sizeof(n),0,0,0);
sendto(server_sock,playerid,n,0,0,0);
and then on the receiving side get the length, and read that many bytes.:
int n;
char *s;
recvfrom(client_sock,&n,sizeof(n),0,0,0);
s = malloc(n)
recvfrom(client_sock,s,n,0,0,0)
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.