Salve a tutti.
Sto implementando un programmino per ricevere da socket TCP.
Il tutto deve essere inserito in una struttura.
codice:
Ecco il codice:

typedef struct {
	int m_textLength;
}HEADER;

typedef struct {
	HEADER m_header;
	char m_buf[MAXRECV];
}MSG;





string CCommunication::receive(int sock){


	string line;
	MSG* pMsg = new MSG;
	memset ( pMsg, 0, sizeof(MSG));
    int status  = ::recv ( sock, pMsg, sizeof(HEADER), 0 );
	if ( status < 0) {
		cout <<  " Error recv" << endl;
	}
	int lengthMessage = pMsg->m_header.m_textLength;
	cout << "CCommunication: " << lengthMessage <<  endl;
	int byteReads  = ::recv ( sock, pMsg->m_buf, lengthMessage , sizeof(MSG) - sizeof(HEADER) );
	while (byteReads < lengthMessage) {
		//Messaggio spezzettato
		byteReads = ::recv ( sock, pMsg->m_buf , lengthMessage, lengthMessage - byteReads );
	}

	if ( byteReads < -1 )	{
		cout <<  " Error recv" << endl;
	}

	line = pMsg->m_buf;
	return line;
}
Ho alcuni dubbi su queste cose??
Non riesco a leggere l'intero come posso fare???