public PopConnection(PopClient popClient)
        {
            tcpClient = new TcpClient(popClient.Host, popClient.Port) { SendTimeout = popClient.Timeout, ReceiveTimeout = popClient.Timeout };

            if (popClient.EnableSsl)
            {
                var secureStream = new SslStream(tcpClient.GetStream());
                secureStream.AuthenticateAsClient(popClient.Host);
                stream = secureStream;
            }
            else
            {
                stream = tcpClient.GetStream();
            }
        }
Example #2
0
        public PopChat(PopClient client)
        {
            this.client = client;
            popConnection = new PopConnection(client);

            Nothing = new NothingPopCommand(popConnection);
            User = new UserPopCommand(popConnection);
            Pass = new PassPopCommand(popConnection);
            Stat = new StatPopCommand(popConnection);
            Retr = new RetrPopCommand(popConnection);
            Quit = new QuitPopCommand(popConnection);
            List = new ListPopCommand(popConnection);
            Uidl = new UidlPopCommand(popConnection);
            Dele = new DelePopCommand(popConnection);

            new IPopCommand[] { Nothing, User, Pass, Stat, Retr, Quit, List, Uidl, Dele }.ToList().ForEach(pc => pc.PopClientLog += PopCommand_PopClientLog);
        }