Qhostaddress ServerIP;
Serverip.setaddress (QString ("192.168.0.7"))//This is a method of assigning IP addresses artificially
Qbytearray Array;
Array.resize (2);
array[0]=0x00;
array[1]=0x04;
BOOL OK;
Char byte1=qstring ("a"). ToInt (&ok,16);
Char byte2=qstring ("a"). ToInt (&ok,16);
array[0]=byte1;
Array[1]=byte2;
Clientudp->writedatagram (array,serverip,1111);//write data to port 1111
Above is a section of code that sends a byte array to Udpsocket, and the annotated part is also available. Char byte2=qstring ("a"). ToInt (&ok,16), which means that "04" is interpreted as an integer according to the 16 number (integer is a data type, there is no distinction of the so-called binary, the integer returned here is by default in decimal notation), Then chop off the first 24 bits to assign to a char type.
In addition to the transmission of data in the network (cable) is a unified big-end storage, but the data before and after receiving the affirmative byte sequence is consistent, will not be reversed, so you can think that the network transmission size of the way is the program ape transparent. (But sometimes if the local machine does not match this, it needs to be corrected). I tested it on my PC and arm and found that both sides were small, no need to fix
int Hex=str.toint (&ok,16);//The qstring is interpreted as a 16-digit number and returns the decimal integer
QString (ByteArray);//byte array conversion to QString
Qbytearray::tohex (), fromhex;//don't know exactly what to do.
Qbytearraybyte a=string.toascii;//don't know exactly what to do with the Welcome master correct