See the following two links for a server and a client example in C#:
-
Server[
^]
-
Client[
^]
In the examples above, the character encoding is assumed to be ASCII (7-bit ASCII), thus, each buffer can be decoded immediately. If you transport any potentially multi-byte data, you must first invent some buffering (e.g. read all data before decoding) and only decode what you properly can decode.
Cheers
Andi