public Manager(DGSendMsg dgSendMsg) { this.dgSendMsg = dgSendMsg; ClientSocket = new Dictionary <string, Socket>(); ClientStatus = new Dictionary <string, bool>(); ChatGroup = new Dictionary <string, string>(); }
/// <summary> /// 客户端管理类 /// </summary> /// <param name="lb">列表控件</param> /// <param name="dgSendMsg">显示消息</param> public ClientManager(System.Windows.Forms.ListBox lb, DGSendMsg dgSendMsg) { //用户列表 this.listClient = lb; //消息委托 this.dgSendMsg = dgSendMsg; //通信字典 ClientSocket = new Dictionary <string, Socket>(); //用户字典 UserSocket = new Dictionary <string, string>(); }
public Maneger(DGSendMsg dgSendMsg) { this.dgSendMsg = dgSendMsg; //IPAddress ip = IPAddress.Parse("123.206.24.215"); IPAddress ip = IPAddress.Parse("127.0.0.1"); int port = 8990; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint endpoint = new IPEndPoint(ip, port); socket.Connect(endpoint); thread = new Thread(ReceMsg); thread.IsBackground = true;//设置后台线程 thread.Start(); socket.Send(Encoding.UTF8.GetBytes("!--LOGIN--!")); dgSendMsg("正在匹配,请稍后..."); }
public Manager(DGSendMsg dgSendMsg) { this.dgSendMsg = dgSendMsg; ClientSocket = new Dictionary <string, Socket>(); UserName = new Dictionary <string, string>(); }