Beispiel #1
0
        } // Disconnect

        private void OnConnected(Socket s)
        {
            if (ConnectionCount() >= 10)
            {
                s.Close();
            }
            else
            {
                for (int intIndex = 0; intIndex <= 9; intIndex++)
                {
                    if (objSMTPSessions[intIndex] == null)
                    {
                        objSMTPSessions[intIndex] = new SMTPSession(s);
                        objSMTPSessions[intIndex].OnDisconnect += OnDisconnect;
                        break;
                    }
                }
            }

            objIPDaemon.AcceptAsync().ContinueWith(t =>
            {
                if (!t.IsFaulted)
                {
                    OnConnected(t.Result);
                }
            }).Wait(0);
        } // OnConnected
Beispiel #2
0
        } // ConnectionCount

        public void OnDisconnect(SMTPSession session)
        {
            for (int intIndex = 0; intIndex <= 9; intIndex++)
            {
                if (objSMTPSessions[intIndex] == session)
                {
                    objSMTPSessions[intIndex] = null;
                }
            }
        } // Disconnect