Example #1
0
        public void OnConnect(IAsyncResult asr)
        {
            PasswordAuthentication auth = asr.AsyncState as PasswordAuthentication;

            outStream = socketConnection.GetStream();
            socketConnection.GetStream().BeginRead(byteBuffer, 0, MAX_READ, new AsyncCallback(OnRead), null);
            WriteMessage(MessageFilter.FormatLoginRequest(auth.Username, auth.Password));
        }
Example #2
0
        public void login(string host, int port)
        {
            PasswordAuthentication auth = listener.GetPasswordAuthentication();

            if (null != auth)
            {
                try
                {
                    socketConnection = new TcpClient();
                    socketConnection.BeginConnect(host, port, new AsyncCallback(OnConnect), auth);
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            else
            {
                throw new Exception("Password Authentication was null");
            }
        }