private void Connect_Click(object sender?? System.EventArgs e)
{
//?????????????
Cursor cr = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
//??110??????POP3??????????
Server = new TcpClient(PopServer.Text??110);
Status.Items.Clear();
try
{
//?????
NetStrm = Server.GetStream();
RdStrm= new StreamReader(Server.GetStream());
Status.Items.Add(RdStrm.ReadLine());
//?????????????
Data = "USER "+ Username.Text+CRLF;
szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
NetStrm.Write(szData??0??szData.Length);
Status.Items.Add(RdStrm.ReadLine());
Data = "PASS "+ Password.Text+CRLF;
szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
NetStrm.Write(szData??0??szData.Length);
Status.Items.Add(RdStrm.ReadLine());
//???????????STAT?????????????????????????????????С
Data = "STAT"+CRLF;
szData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray());
NetStrm.Write(szData??0??szData.Length);
Status.Items.Add(RdStrm.ReadLine());
//????????
Connect.Enabled = false;
Disconnect.Enabled = true;
Retrieve.Enabled = true;
//???????????????
Cursor.Current = cr;
}
catch(InvalidOperationException err)
{
Status.Items.Add("Error: "+err.ToString());
}
}