欢迎来到天天文库
浏览记录
ID:32682730
大小:55.00 KB
页数:24页
时间:2019-02-14
《简单的多人聊天系统》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、/******************8ChatServer:**************************/usingSystem;usingSystem.Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;usingSystem.Threading;usingSystem.Net.Sockets;usingSystem.Net;namespaceChat_Server{ /// ///Form1的摘要说明。 //
2、/ publicclassForm1:System.Windows.Forms.Form { /// ///必需的设计器变量。 /// privateSystem.ComponentModel.Containercomponents=null; staticintlistenport=6666; Socketclientsocket; privateSystem.Windows.Forms.ListBoxlbClients; ArrayListclients; privateSystem.Windows.Forms.Buttonbu
3、tton1; Threadclientservice; privateSystem.Windows.Forms.Labellabel1; ThreadthreadListen; publicForm1() { InitializeComponent(); } /// ///清理所有正在使用的资源。 /// protectedoverridevoidDispose(booldisposing) { if(disposing) { if(clientservice!=null) { clientservice.Abort();
4、 } if(threadListen!=null) { try { threadListen.Abort(); } catch(Exceptionex) { threadListen=null; } } if(components!=null) { components.Dispose(); } } base.Dispose(disposing); } #regionWindows窗体设计器生成的代码 /// ///设计器支持所需的方法-不要使用代码编辑器修改 ///此方法
5、的内容。 /// privatevoidInitializeComponent() { this.lbClients=newSystem.Windows.Forms.ListBox(); this.button1=newSystem.Windows.Forms.Button(); this.label1=newSystem.Windows.Forms.Label(); this.SuspendLayout(); // //lbClients // this.lbClients.ItemHeight=12; this.lbClients.Location
6、=newSystem.Drawing.Point(16,24); this.lbClients.Name="lbClients"; this.lbClients.Size=newSystem.Drawing.Size(184,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
7、="button1"; this.button1.Click+=newSystem.EventHandler(this.button1_Click); // //label1 // this.label1.Location=newSystem.Drawing.Point(240,136); this.label1.Name="label1"; this.label1.Size=newSystem.Drawi
此文档下载收益归作者所有