欢迎来到天天文库
浏览记录
ID:20619585
大小:55.00 KB
页数:17页
时间:2018-10-14
《简单多人聊天》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、简单的多人聊天(C#)/********************************8ChatServer:***********************/usingSystem;usingSystem.Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;usingSystem.Threading;usingSystem.Net.Sockets;usingSystem.Net;namespaceChat_
2、Server{ /// ///Form1的摘要说明。 /// publicclassForm1:System.Windows.Forms.Form { /// ///必需的设计器变量。 /// privateSystem.ComponentModel.Containercomponents=null; staticintlistenport=6666; Socketclientsocket; privateSystem.Windows.Forms.ListBoxlbCl
3、ients; ArrayListclients; privateSystem.Windows.Forms.Buttonbutton1; Threadclientservice; privateSystem.Windows.Forms.Labellabel1; ThreadthreadListen; publicForm1() { InitializeComponent(); } /// ///清理所有正在使用的资源。 /// protectedoverridevoidDispose(bo
4、oldisposing) { if(disposing) { if(clientservice!=null) { clientservice.Abort(); } if(threadListen!=null) { try { threadListen.Abort(); } catch(Exceptionex) { threadListen=null; } } if(components!=null) {
5、 components.Dispose(); } } base.Dispose(disposing); } #regionWindows窗体设计器生成的代码 /// ///设计器支持所需的方法-不要使用代码编辑器修改 ///此方法的内容。 /// privatevoidInitializeComponent() { this.lbClients=newSystem.Windows.Forms.ListBox(); this.button1=newSystem.Windows.F
6、orms.Button(); this.label1=newSystem.Windows.Forms.Label(); this.SuspendLayout(); // //lbClients // this.lbClients.ItemHeight=12; this.lbClients.Location=newSystem.Drawing.Point(16,24); this.lbClients.Name="lbClients"; this.lbClients.Size=newSystem.Drawing.Size(18
7、4,268); this.lbClients.TabIndex=0; // //button1 // this.button1.Location=newSystem.Drawing.Point(272,56); this.button1.Name="button1"; this.button1.TabIndex=1; this.button1.Text="button1"; this.button1.Click+=newSystem.EventHandler(this.button1_Click); // //la
8、bel1 // this.label1.Lo
此文档下载收益归作者所有