Home > Software engineering >  Consult how TCP Client sends a carriage return
Consult how TCP Client sends a carriage return

Time:09-17

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);
}
}

CodePudding user response:

reference 1/f, zhao teacher reply:
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);
}
}

This is not what I want to answer,
I ask is when I want to send in the PRESET - what a 1 after add
To make the receiver received
53 45 to 54 50 52 45 20 61 31 20 0 2 d d

CodePudding user response:

'\ r'
'\ x0d'

CodePudding user response:

The
quoted zhao teacher reply: 3/f

'\ r''\ x0d'

Both used, is wrong

CodePudding user response:

reference 4 floor weixin_41870591 response:
Quote: quoted zhao teacher reply: 3/f

'\ r''\ x0d'

It's wrong to both used,

Estimation is your agreement didn't analysis, clearly transmit data of enter 0 d does not necessarily mean, how to parse the number depends on the receiving end

CodePudding user response:

reference 5 floor gouyanfen reply:
Quote: refer to 4th floor weixin_41870591 response:

Quote: refer to the third floor 4 teacher zhao response:

'\ r''\ x0d'

It's wrong to both used,

Estimation is your agreement didn't analysis, clearly transmit data of enter 0 d does not necessarily mean, how to parse the number depends on the receiving end

The software testing is to use TCP Client ah, I also not actually must back to the car, the purpose of receiving end when I send the end of the string can receive 0 d

CodePudding user response:

Sending code to look at you

CodePudding user response:

refer to 7th floor gouyanfen response:
send you send code to see

Now I sent the sender string PRESET - a 1 there is space behind (1)
The receiver received:
53 45 50 52 45 54 2 d 61 20 31 20
But I need receive the receiving end of:
53 45 50 52 45 54 20 61 31 20 0 2 d d
To perform a controlled, the problem is how to add 0 d in the back to him

CodePudding user response:

I'm talking about the code, you are talking about the software, not a channel, send a carriage return
Char * SendData publishes the event="https://bbs.csdn.net/topics/PRESET - a 1/n";
Send (SocketID, (char *) & amp; SendData publishes the event, strlen (SendData publishes the event) + 1, 0);
Solved, not write code, you can't discuss

CodePudding user response:

references 9 f gouyanfen response:
I am talking about the code, you are talking about the software, not a channel, send a carriage return
Char * SendData publishes the event="https://bbs.csdn.net/topics/PRESET - a 1/n";
Send (SocketID, (char *) & amp; SendData publishes the event, strlen (SendData publishes the event) + 1, 0);
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related