dont use sprintf, it's unsafe. use sprintf_s, or whatever the bound checked version is.
As for your problem, I can't say at a glance. Looks like you'll have to get better at debugging. Print out what data goes out, what data comes in, into the console, or a file, put breakpoints, and just step through the code.
Here's a simpler way to generate packets.
char packet; int packetlen = sprintf_s(packet, sizeof(packet), "POS%d%s=%dx%d", nick.size(), (const char*)nick, pos.x, pos.y);
Finally, I would refrain from using that sort of verbose format, and use some form of binary serialisation, or some other library that will give you the opportunity to format, and parse text strings more efficiently.
Or if you want some readable packet, for debugging, 'tokenise' the string. Much easier to digest on the other end.
char packet; int packetlen = sprintf_s(packet, sizeof(packet), "msgid=%s, player=%s, posx=%d, posy=%d", "POS", (const char*)nick, pos.x, pos.y);