After consult the TCP Client sends a string to send a return Now I sent the sender string PRESET - a 1 there is space behind (1) The receiver received: 50 52 45 53 45 54 2 d 61 20 and 20 This piece of string after I also need a 0 d program instructions to control the receiving end, then the 0 d in sending the how to write, to make the receiver received 0 d Is the receiver to receive: 50 52 45 53 45 to 54 20 61 20 and 20 0 d to 2 d controlled Thanks to the great god taught, novice don't understand TCP
CodePudding user response:
Computer memory or file content or transport it is just a one-dimensional binary byte array and its corresponding binary address; The human brain to a computer memory or file contents or transfer the content of the one-dimensional binary byte array and its corresponding binary address some parts as an integer, number of signed/unsigned number, floating point Numbers, complex Numbers, letters, digits, Chinese/Korean/French... Character/string, assembly instructions, functions, function parameters, heap, stack, arrays, Pointers, array pointer and pointer array, the array of arrays, pointer to pointer, two-dimensional arrays, character lattice, the coordinates of character strokes, black and white binary images and grayscale images, color images, audio, video, fingerprint information, id information...
void HexDump) (char * buf, int len, int addr) { Int I, j, k; Char binstr [80].
for (i=0; iIf (0==16) (I %) { Sprintf (binstr, "% x - 08", I + addr); Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]); } else if (15==16) (I %) { Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]); Sprintf (binstr, "% s", binstr); For (j=I - 15; j<=I; J++) { Sprintf (binstr, "% s % c," binstr, ('! '} Printf (" % s \ n ", binstr); } else { Sprintf (binstr, "% s % 02 x", binstr, buf (unsigned char) [I]); } } If (0! 16)=(I %) { 16 k=16 - (I %); For (j=0; jSprintf (binstr, "% s", binstr); } Sprintf (binstr, "% s", binstr); K=16 - k; For (j=I - k; jSprintf (binstr, "% s % c," binstr, ('! '} Printf (" % s \ n ", binstr); } }