NetCoreServer
NetCoreServer copied to clipboard
Corrupted received data
I am wrapping string data in object (id and data) and serializing it to json , and when I am trying to send big data, in other side I get only 8192 bytes and corrupted json string. How can I fix that?
I tried to find where the data is separating, but didn't find it. Can I wrap it in object after data will have been separated?
NetCoreServer use stream protocol model. All data send into stream and we only guarantee the order of send/received bytes in stream, but messages/objects could be spited. To overcome this you have to create top level message protocol. The simple idea of it is to send message size in first 4 bytes and then message body. On receive side read 4 bytes as a message size and then collect message data of the size. And only then deserialize data into object and process it.
One reason I love your NetCoreServer is its ability to be the foundation for engineers to learn more about OSI layer 5, 6 and 7 in situations as described above.
@chronoxor How can i read exact byte count from session? I need to disable receive buffer.