private void Send(string command)
{
// add CRLF to the message
command+="\r\n";
// convert message buffer to array of chars
byte[] buffer=Encoding.ASCII.GetBytes(command.ToCharArray());
// send buffer
int bytesSent=socket.Send(buffer,buffer.Length, 0);
if (bytesSent!=buffer.Length)
throw new Exception("failed to send request to server");
}