public void Run()
{
try
{
string s;
using (TcpClient client = _server.AcceptTcpClient())
{
Trace("connection", EndPoint.Port);
using (NetworkStream ns = client.GetStream())
{
WriteNS(ns, "220 localhost\r\n");
using (StreamReader r = new StreamReader(ns, Encoding.UTF8))
{
while ((s = r.ReadLine()) != null && Dispatch(ns, r, s))
;
}
}
}
}
catch (SocketException e)
{
// The _server might have been stopped.
if (e.SocketErrorCode != SocketError.Interrupted)
throw;
}
}