BrandonPotter / SimpleTCP

Straightforward .NET library to handle the repetitive tasks of spinning up and working with TCP sockets (client and server).
Apache License 2.0
365 stars 108 forks source link

Default delimiter 0x13 should be 0x0D ? #29

Closed davi2td closed 6 years ago

davi2td commented 6 years ago

Hi, I love this ! Very helpful. Maybe I'm wrong, but I believe the default delimiter should be 0x0D(or 0x0A if going with newline \n as mentioned in the example). Either way, not a big deal just stumped me at first ;) This rocks thanks! -TD

Adriien-M commented 6 years ago

+1, the WriteLine function does not work... In addition, Environment.NewLine works too.

harleyknd1 commented 6 years ago

0x13 is hard coded to be at the end of WriteLine, not sure why the dev said NewLine because 0x13 is XOFF....

bodyweightenergy commented 6 years ago

SimpleTcpClient.WriteLine will work, but on the server side you'll need to subscribe to DelimitedDataReceived event, not DataReceived, since the latter returns everything in the receive buffer.

Actually, having the Delimiter being a non-printable character is a better idea, since you might want to use Environment.NewLine or '\n' as part of your message (a single, multiline message). You just have to make sure both Server and Client have the same delimiter (so just leave it as default value, 0x13).