110,534
社区成员
发帖
与我相关
我的任务
分享
private void Connect()
{
TcpClient sender = new TcpClient(POPServer, 110);
Byte[] outbytes;
string input;
string readuser = string.Empty;
string readpwd = string.Empty;
try
{
ns = sender.GetStream();
sr = new StreamReader(ns);
sr.ReadLine();
//检查密码
input = "USER " + user + "\r\n";
outbytes = System.Text.Encoding.ASCII.GetBytes(input.ToCharArray());
ns.Write(outbytes, 0, outbytes.Length);
readuser = sr.ReadLine();
Array.Clear(outbytes, 0, outbytes.Length);
input = "PASS " + pwd + "\r\n";
outbytes = System.Text.Encoding.ASCII.GetBytes(input.ToCharArray());
ns.Write(outbytes, 0, outbytes.Length);
readpwd = sr.ReadLine(); //Console.WriteLine(sr.ReadLine() );
}
catch
{
System.Windows.Forms.MessageBox.Show("用户名或密码错误");
}
}