Hello.
I have a question about the portability sending data between Windows and Linux or VxWorks.
I have this qt code to send data from a Windows machine.
Code:
QByteArray block; out << (quint16)0; out <<string; out.device()->seek(0); out << (quint16)(block.size() - sizeof(quint16)); if(tcpSocket->isWritable()){ tcpSocket->write(block); }
And the datas are arriving well when I use a qt program as receiver, but when i use the following c++ code to read in another machine the datas are not the expected.
Code:
// This is a wxworks command and in datagrama_rx char* type receives the sending datas. if (recvfrom(descriptor, datagrama_rx, SIZE_DATAGRAMA, 0, (sockaddr *)&direccion_origen, &addr_len) !=ERROR) mensajeRecibido.mensaje=datagrama_rx;
The problem is that datagrama_rx receives what I was written in block, i think the block.data() but when i do the assignation in mensajeRecibido.mensaje which is a char* too it is not well than and with qt code in windows it was working well.
I dont know if i am forgetting something important. Could somone help me?
Thank you in advance.
