in reply to Telnet Modes

since you are running a tcp server and expecting to control telnet behavior on the client side you may want to look at the telnet RFC and implement the protocol's way of setting buffering - more info can be had at here.

-Waswas