TCP



  • My server is not receiving data from my client.
    Don't understand what does seek() do and why need 2object out and block at the same time.

    Below is my code

    @

                socket.connectToHost(ServerIP,10010);
                qint16 CRC;
                unsigned char TCPdata[5];
                TCPdata[0]=0x20;
                TCPdata[1]=0x20;
                TCPdata[2]=0x00;
                CRC =ModbusCRC((unsigned char*)TCPdata,3);
    
    
    
                QByteArray block;
                QDataStream out(&block,QIODevice::WriteOnly);
                out.setVersion(QDataStream::Qt_5_0);
    
                out.device()->seek(0);
                out<<0x20<<DeviceNum<<0x00<<CRC;
    
               socket.writeData(block.data(),block.size());
    

    @


  • Lifetime Qt Champion

    Hi,

    Please don't post the almost same question twice, closing this one

    "Duplicate":http://qt-project.org/forums/viewthread/50953/


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.