HELLO!
I could send and receive any type of string for my application .... but all I cause small problem ... I have memory leaks!
I could send and receive any type of string for my application .... but all I cause small problem ... I have memory leaks!
Code:
//INICIA TRANSACCIONALIDAD
while( (bytesRecibidos = recv(sock,bufRecibidos,sizeof(bufRecibidos),0))){
//RECEPCION DE TRAMA DEL SERVIDOR
OLECHAR* oleChar = NULL;
oleChar = (OLECHAR*)calloc(bytesRecibidos-1, sizeof(OLECHAR));
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, bufRecibidos + 2, -1, oleChar, bytesRecibidos-1);
inXML = SysAllocString(oleChar);
free(oleChar);
//TRANSACCIONALIDAD
map1-> ejecutarTX_PRUEBA_DATOS(&inXML,&outXML);
//ENVIO DE TRAMA AL SERVIDOR - DEBE SER FORMATO UTF8 MODIFICADO -> ENVIO UTF16
_bstr_t strOut(outXML);
LPWSTR str = ((WCHAR *) strOut);
nInputStrLen = wcslen (str);
nOutputStrLen = WideCharToMultiByte (CP_UTF8, 0, str, nInputStrLen, NULL, 0, 0, 0) + 2;
UTFSring = new char [nOutputStrLen];
memset (UTFSring, 0x00, nOutputStrLen);
WideCharToMultiByte(CP_UTF8, 0, str, nInputStrLen, UTFSring, nOutputStrLen, 0, 0);
longitud = strlen((char *)UTFSring);
bufEnviados[0] = (longitud >> 8);
bufEnviados[1] = (longitud & 0xff);
strcpy(bufEnviados + 2 , (char *) UTFSring );
delete [] UTFSring;
UTFSring = NULL;
str = NULL;
bytesEnviados = send(sock,bufEnviados, longitud + 2,0);
}
Help!