Right now, I am connecting the client to netcat and sending data through that, so there is no code for that.
I redid the test and it now prints the received var with this line:
std::cout << "Received: " << received << std::endl;
Here are the results of the test:
What was sent from the server (netcat):
123
1234
12345
123456
1234567
12345678
123456789
1234567890
12345678901
123456789012
1234567890123
12345678901234
123456789012345
1234567890123456
12345678901234567
123456789012345678
1234567890123456789
12345678901234567890
And this is how the client displayed it: (It's pretty mangled so I had to display it without the code tags so the actual symbols are there)
123
■ h♥×w‗☺×wReceived: 4
1234
h♥×w‗☺×wReceived: 5
12345
h♥×w‗☺×wReceived: 6
123456
h♥×w‗☺×wReceived: 7
1234567
h♥×w‗☺×wReceived: 8
12345678
♥×w‗☺×wReceived: 9
123456789
×w‗☺×wReceived: 10
1234567890
w‗☺×wReceived: 11
12345678901
‗☺×wReceived: 12
123456789012
☺×wReceived: 13
1234567890123
×wReceived: 14
12345678901234
wReceived: 15
123456789012345
Received: 16
1234567890123456
Received: 17
12345678901234567
UvH¹═☻Received: 18
123456789012345678
vH¹═☻Received: 19
1234567890123456789
H¹═☻Received: 20
12345678901234567890
¹═☻Received: 21
With some other tests I did, I noticed a pattern.
I will illustrate it.
Server: 12356
Client: 123456
Server: 123
Client: 123<linebreak>56
Server: 12
Client: 12<linebreak>56
Server: 123456
Client: 123456
Server: 1234567
Client: 1234567
Server: 123
Client: 123<linebreak>567
It's like, a "shadow" of the largest amount of characters so far is kept in the buffer and it will print out the amount of characters in the shadow minus the amount of characters actually sent, after a linebreak.
Also, before the the number before the linebreak is sent, there is a bunch of garbled characters, IE
h♥×w‗☺×w123