C#????????????
???????????? ???????[ 2013/8/14 13:40:22 ] ????????
/ /
/ / textBox1?????
/ /
=??System.Drawing.Point this.textBox1.Location??88??16??;
this.textBox1.Multiline = TRUE;
this.textBox1.Name =“textBox1??”;
this.textBox1.Size??=??System.Drawing.Size??104??24??;
this.textBox1.TabIndex = 1;
this.textBox1.Text =“”;
/ /
/ / textBox2?У???
/ /
this.textBox2.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
this.textBox2.Location =??System.Drawing.Point?£?8??64??;
this.textBox2.Multiline = TRUE;
this.textBox2.Name =“textBox2??”;
this.textBox2.ReadOnly = TRUE;
this.textBox2.ScrollBars = System.Windows.Forms.ScrollBars.Vertical??;
??System.Drawing.Size this.textBox2.Size =??320??80??;
this.textBox2.TabIndex = 2;
this.textBox2.Text =“”;
/ /
/ /???
/ /
this.button1.Location =??System.Drawing.Point?£?208??16??;
this.button1.Name =“Button1”??;
this.button1.Size =??System.Drawing.Size??64??24??;
this.button1.TabIndex = 3;
this.button1.Text =“???”;
this.button1.Click + = System.EventHandler??this.LoginBtn_click????;
/ /
/ /???
/ /
this.button2.Location =??System.Drawing.Point??48??280??;
this.button2.Name =“button2??”;
this.button2.Size??=??System.Drawing.Size??72??24??;
this.button2.TabIndex = 4;
this.button2.Text =“????”;
this.button2.Click + = System.EventHandler??this.SendBtn_click????;
/ /
/ /???3
/ /
this.button3.Location =??System.Drawing.Point??200??280??;
this.button3.Name =“???3”;
this.button3.Size =??System.Drawing.Size??80??24??;
this.button3.TabIndex = 5;
this.button3.Text =“???”;
this.button3.Click + = System.EventHandler??this.DiscBtn_click????;
/ /
/ / textBox3??
/ /
this.textBox3.Location =??System.Drawing.Point?£?8??17??6??;
this.textBox3.Multiline = TRUE;
this.textBox3.Name =“textBox3”;
??System.Drawing.Size this.textBox3.Size =??320??88??;
this.textBox3.TabIndex = 6;
this.textBox3.Text =“”;
/ /
/ / label1??
/ /
this.label1.Location =??System.Drawing.Point?£?48??24??;
this.label1.Name =“label1??”;
??System.Drawing.Size this.label1.Size =??40??24??;
this.label1.TabIndex = 7;
this.label1.Text =“??????”;
/ /
/ / LABEL2
/ /
this.label2.Location =??System.Drawing.Point?£?8??48??;
this.label2.Name =“label2??”;
this.label2.Size =??System.Drawing.Size??112??16??;
this.label2.TabIndex = 8;
this.label2.Text =“??????????”;
/ /
/ / LABEL3??
/ /
this.label3.Location =??System.Drawing.Point?£?8??152??;
this.label3.Name =“LABEL3”;
this.label3.Size =??System.Drawing.Size??128??16??;
this.label3.TabIndex = 9;
this.label3.Text =“???????????”;
/ /
/ / StatusBar1?У???
/ /
this.statusBar1.Location =??System.Drawing.Point??0??318??;
this.statusBar1.Name =“StatusBar1??”;
this.statusBar1.Size =??System.Drawing.Size??336??16??;
this.statusBar1.TabIndex = 11;
this.statusBar1.Text =“??”;
/ /
/ / Form1??
/ /
this.AutoScaleBaseSize =??System.Drawing.Size??6??14??;
??System.Drawing.Size this.ClientSize =??336??334??;
this.Controls.AddRange????System.Windows.Forms.Control??[] {
??this.statusBar1??
??this.label3??
this.label2??
??this.label1??
??this.textBox3??
??this.button3??
this.button2??
this.button1??
this.textBox2??
this.textBox1}??;
this.Name =“Form1??”;
this.Text =“ChatServer”;??
this.ResumeLayout?????;
}
??endregion
/ / /????; summarygt
/ / /??ó??????????
/ / / </??>
[STAThread]
?????Ч?????????
{
Application.Run????Form1???????;
}
??????ЧLoginBtn_click???????????????System.EventArgs??
{
HOSTIP????????“127.0.0.1”??;
????
{
ChatServer =?μ?IPEndPoint??HOSTIP??Int32.Parse??“8080”????;
=?μ?Socket ChatSocket??AddressFamily.InterNetwork??SocketType.Stream??ProtocolType.Tcp????;
ChatSocket.Bind??ChatServer??;
ChatSocket.Listen??50??;
statusBar1.Text = textBox1.Text +“logoned on.Now?????......”;
AcceptedSocket = ChatSocket.Accept????;
??????=?μ?Thread???μ?ThreadStart??ChatProcess?????;
thread.Start????;
}
?????????EE??
{statusBar1.Text ee.Message;}
}
?????ЧChatProcess????
{
?????AcceptedSocket.Connected??
{
statusBar1.Text =“?????????”;
??????
{
[???] ReceivedByte =?μ????[64];
AcceptedSocket.Receive??ReceivedByte ReceivedByte.Length??0??;
??ReceivedStr = System.Text.Encoding.BigEndianUnicode.GetString??ReceivedByte??;
textBox2.AppendText??ReceivedStr +“ R N”??;
}
}
}
??????ЧSendBtn_click???????????????System.EventArgs??
{
????
{
[???] SentByte =?μ????[64];
??SentStr = textBox1.Text +“............”+ textBox3.Text +“ R N”;
SentByte = System.Text.Encoding.BigEndianUnicode.GetBytes??SentStr.ToCharArray??????;
AcceptedSocket.Send??SentByte SentByte.Length??0??;
textBox3.Clear????;
}
?
{statusBar1.Text =“??????????”;}
}
??????ЧDiscBtn_click???????????????System.EventArgs??
{
????
{
ChatSocket.Close????;
AcceptedSocket.Close????;
statusBar1.Text =“????????”
}
{statusBar1.Text =“??????????”;}
}
}
}
??????

???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11