/// <summary>
 /// Writes a message to the server
 /// </summary>
 /// <param name="Message">Information to send to the server</param>
 private void WriteMessage(string Message)
 {
     System.Text.ASCIIEncoding Encoding = new System.Text.ASCIIEncoding();
     byte[] Buffer = new byte[Message.Length];
     Buffer = Encoding.GetBytes(Message);
     if (!UseSSL)
     {
         NetworkStream Stream = GetStream();
         Stream.Write(Buffer, 0, Buffer.Length);
     }
     else
     {
         if (SSLStreamUsing == null)
         {
             SSLStreamUsing = new SslStream(GetStream());
             SSLStreamUsing.AuthenticateAsClient(Server);
         }
         SSLStreamUsing.Write(Buffer, 0, Buffer.Length);
     }
 }
        /// <summary>
        /// Gets the response from the server
        /// Note that this uses TCP/IP to get the
        /// messages, which means that the entire message
        /// may not be found in the returned string
        /// (it may only be a partial message)
        /// </summary>
        /// <returns>The response from the server</returns>
        private string GetResponse()
        {
            byte[] Buffer = new byte[1024];
            System.Text.ASCIIEncoding Encoding = new System.Text.ASCIIEncoding();
            string Response = "";

            if (!UseSSL)
            {
                NetworkStream ResponseStream = GetStream();
                while (true)
                {
                    int Bytes = ResponseStream.Read(Buffer, 0, 1024);
                    Response += Encoding.GetString(Buffer, 0, Bytes);
                    if (Bytes != 1024)
                    {
                        break;
                    }
                }
            }
            else
            {
                if (SSLStreamUsing == null)
                {
                    SSLStreamUsing = new SslStream(GetStream());
                    SSLStreamUsing.AuthenticateAsClient(Server);
                }
                while (true)
                {
                    int Bytes = SSLStreamUsing.Read(Buffer, 0, 1024);
                    Response += Encoding.GetString(Buffer, 0, Bytes);
                    if (Bytes != 1024)
                    {
                        break;
                    }
                }
            }
            return(Response);
        }