private void NhanTinNhan(object obj) { var client = (MayKhach)obj; try { while (true) { var data = client.Receive(); var messager = TryConvertObject.SwithToMessager(data); var processor = new SeverMessageProcessor(client, clientManager); messager.Accept(processor); foreach (var item in processor.ListReiceveMassager) { if (item.Client != null) { SendToClient(item.Client as MayKhach, item); } else { SendToClient(client, item); } } } } catch (Exception) { Console.WriteLine("exception : client close " + client.TenMay); clientManager.Remove(client); } }
/// <summary> /// Lấy dữ liệu từ máy khác /// </summary> /// <param name="obj"></param> void NhanTinVe(object obj) { var client = (MayKhach)obj; try { while (true) { var data = client.Receive(); var message = ObjectConvert.Binnary2Object(data); Logging.Debug("Recieved data from:" + client.TenMay); var processor = new ServerMessageProcessor(clientManager, client); message.Accept(processor); foreach (var item in processor.Response) { if (item.Client != null) { SendToClient(item.Client as MayKhach, item); } else { SendToClient(client, item); } } } } catch { clientManager.Remove(client); } }