look its really easy:
char szData[256];
if(recv(sock, szData, 256, flags))
callback(szData, 256, id);
since this is all executed from a function its only on the stack!
all the data will cleared after the engine function which called your callback returns which is kind of de-allocate.
So when you ONLY use the stuff in your callback its fine, if you need it longer memcpy it to a global structure