static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
System.Net.IPEndPoint ipEndPoit = new IPEndPoint(IPAddress.Parse("127.0.0.1"),110);
TcpListener tcpServer = new TcpListener(ipEndPoit);
tcpServer.Start();
TcpClient tcpClient = tcpServer.AcceptTcpClient();
NetworkStream ns = tcpClient.GetStream();
byte[] outbytes = Encoding.ASCII.GetBytes("+OK Welcome"+Environment.NewLine);
ns.Write(outbytes,0,outbytes.Length);
byte[] userBytes = new byte[255];
ns.Read(userBytes,0,userBytes.Length);
outbytes = Encoding.ASCII.GetBytes("+OK" + Environment.NewLine);
ns.Write(outbytes,0,outbytes.Length);
byte[] pwdBytes = new byte[255];
ns.Read(pwdBytes,0,pwdBytes.Length);
Console.WriteLine("帐户名称:" + Encoding.ASCII.GetString(userBytes));
Console.WriteLine("帐户密码:" + Encoding.ASCII.GetString(pwdBytes));
Console.Read();
ns.Close();
tcpClient.Close();
tcpServer.Stop();
}