![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
<%...@ Page language="c#" Codebehind="qunFa.aspx.cs" AutoEventWireup="false" Inherits="liuwei.hanmail.qunFa" %>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<HTML>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<HEAD>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<title>qunFa</title>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<meta content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<meta content=C# name=CODE_LANGUAGE>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<meta content=JavaScript name=vs_defaultClientScript>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<meta content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</HEAD>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<body MS_POSITIONING="GridLayout">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<form id=Form1 method=post runat="server">
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:ListBox id="ListBoxMsg" style="Z-INDEX: 118; LEFT: 136px; POSITION: absolute; TOP: 344px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="440px" Height="184px"></asp:ListBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label11" style="Z-INDEX: 108; LEFT: 120px; POSITION: absolute; TOP: 320px" runat="server">信息查看</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label10" style="Z-INDEX: 117; LEFT: 112px; POSITION: absolute; TOP: 16px" runat="server">SMTP服务器地址</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label9" style="Z-INDEX: 100; LEFT: 128px; POSITION: absolute; TOP: 48px" runat="server">用户名</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxSrv" style="Z-INDEX: 101; LEFT: 264px; POSITION: absolute; TOP: 24px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="240px"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label8" style="Z-INDEX: 102; LEFT: 360px; POSITION: absolute; TOP: 48px" runat="server">口令</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxUser" style="Z-INDEX: 103; LEFT: 192px; POSITION: absolute; TOP: 48px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="152px"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxPwd" style="Z-INDEX: 104; LEFT: 416px; POSITION: absolute; TOP: 48px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="168px" TextMode="Password"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label4" style="Z-INDEX: 105; LEFT: 128px; POSITION: absolute; TOP: 80px" runat="server">发信人</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label5" style="Z-INDEX: 106; LEFT: 360px; POSITION: absolute; TOP: 80px" runat="server">收信人</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxSend" style="Z-INDEX: 107; LEFT: 192px; POSITION: absolute; TOP: 80px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxRev" style="Z-INDEX: 109; LEFT: 416px; POSITION: absolute; TOP: 80px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="168px"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label6" style="Z-INDEX: 110; LEFT: 128px; POSITION: absolute; TOP: 112px" runat="server">主题</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxSubject" style="Z-INDEX: 112; LEFT: 192px; POSITION: absolute; TOP: 104px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="392px"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:TextBox id="TextBoxMailText" style="Z-INDEX: 113; LEFT: 144px; POSITION: absolute; TOP: 160px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Width="440px" TextMode="MultiLine" Height="120px"></asp:TextBox>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="Label7" style="Z-INDEX: 114; LEFT: 128px; POSITION: absolute; TOP: 136px" runat="server">邮件内容</asp:Label>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Button id="ButtonSend" style="Z-INDEX: 115; LEFT: 464px; POSITION: absolute; TOP: 296px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server" Text="发送"></asp:Button>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<asp:Label id="LabelErr" style="Z-INDEX: 116; LEFT: 696px; POSITION: absolute; TOP: 136px"
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
runat="server"></asp:Label></FORM>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</body>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</HTML>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Collections;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.ComponentModel;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Data;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Drawing;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Web;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Web.SessionState;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Web.UI;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Web.UI.WebControls;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Web.UI.HtmlControls;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.IO;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Net;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Net.Sockets;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
namespace Sendmail
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//// <summary>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
/// qunFa 的摘要说明。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
/// </summary>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public class qunFa : System.Web.UI.Page
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label LabelErr;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Button ButtonSend;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label7;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxMailText;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxSubject;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label6;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxRev;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxSend;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label5;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label4;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxPwd;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxUser;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label8;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.TextBox TextBoxSrv;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label9;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label11;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.ListBox ListBoxMsg;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
protected System.Web.UI.WebControls.Label Label10;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
TcpClient smtpSrv;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
NetworkStream netStrm;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string CRLF=" ";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private void Page_Load(object sender, System.EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
override protected void OnInit(EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
InitializeComponent();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
base.OnInit(e);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//// <summary>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
/// 此方法的内容。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
/// </summary>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private void InitializeComponent()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ButtonSend.Click += new System.EventHandler(this.ButtonSend_Click);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.Load += new System.EventHandler(this.Page_Load);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
#endregion
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private void ButtonSend_Click(object sender, System.EventArgs e)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Clear();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string[] userList=this.TextBoxRev.Text.Split(',');
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(int i=0;i<userList.Length;i++)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
Qun(userList[i]);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public void Qun(string userList)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string data;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
smtpSrv=new TcpClient(this.TextBoxSrv.Text,25);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
netStrm=smtpSrv.GetStream();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
StreamReader rdStrm=new StreamReader(smtpSrv.GetStream());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream("EHLO Local");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream("AUTH LOGIN");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data=this.TextBoxUser.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data=AuthStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data=this.TextBoxPwd.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data=AuthStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="MAIL FROM:<"+this.TextBoxSend.Text+">";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="RCPT TO:<"+userList+">";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream("DATA");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="Date:"+DateTime.Now;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="From:"+this.TextBoxSend.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="TO:"+userList;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="SUBJECT:"+this.TextBoxSubject.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
data="Reply-TO:"+this.TextBoxSend.Text;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(data);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream("");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(this.TextBoxMailText.Text);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream(".");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.WriteStream("QUIT");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.ListBoxMsg.Items.Add(rdStrm.ReadLine());
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
netStrm.Close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
rdStrm.Close();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.LabelErr.Text="发送成功!";
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch(Exception ex)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
this.LabelErr.Text=ex.ToString();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private void WriteStream(string strCmd)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strCmd+=CRLF;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] bw=System.Text.Encoding.Default.GetBytes(strCmd);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
netStrm.Write(bw,0,bw.Length);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
private string AuthStream(string strCmd)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
try
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] by=System.Text.Encoding.Default.GetBytes(strCmd);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
strCmd=Convert.ToBase64String(by);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
catch(Exception err)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return err.ToString();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return strCmd;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}