public void Start() { this.Running = true; TcpListener imapServer = new TcpListener(this.IP, Port); imapServer.Start(); Trace.TraceInformation("Start imap server on {0}:{1}", IP.ToString(), Port); while (this.Running) { TcpClient client = imapServer.AcceptTcpClient(); IMAPSession session = new IMAPSession(client); Thread thread = new Thread(new ParameterizedThreadStart(this.SessionStart)); thread.Start(session); } }
void SessionStart(object session) { IMAPSession sess = session as IMAPSession; sess.CommandLoop(); }