public void Thubai() { ServerResponse response = new ServerResponse(ServerResponseType.FinishExam, null); foreach (Socket item in ListClient) { item.Send(response.Serialize()); } }
public void SendListStudent(List <Student> students) { ServerResponse response = new ServerResponse(ServerResponseType.SendListStudentExcel, students); byte[] buff = response.Serialize(); foreach (Socket item in ListClient) { item.Send(buff); } }
public void StartExam(string time) { ServerResponse response = new ServerResponse(ServerResponseType.BeginExam, time); byte[] buff = response.Serialize(); foreach (Socket item in ListClient) { item.Send(buff); } }
public void SendThoiGianThi(string timeexam) { ServerResponse response = new ServerResponse(ServerResponseType.SendThoiGianThi, timeexam); byte[] buff = response.Serialize(); foreach (Socket item in ListClient) { item.Send(buff); } }
public void SendMonThi(string monthi) { ServerResponse response = new ServerResponse(ServerResponseType.SendMonThi, monthi); byte[] buff = response.Serialize(); foreach (Socket item in ListClient) { item.Send(buff); } }
public void SendmessageAll(string mess) { ServerResponse response = new ServerResponse(ServerResponseType.SendMessage, mess); byte[] buff = response.Serialize(); foreach (Socket item in ListClient) { item.Send(buff); } }
public void DisconnectAll() { foreach (Socket item in ListClient) { ServerResponse response = new ServerResponse(ServerResponseType.DisconnectAll, null); item.Send(response.Serialize()); } ListClient.Clear(); maytinhInfoManager.DisconnectAll(); }
public void PhatDe(List <string> dsDeThi) { if (dsDeThi.Count == 0) { return; } List <FileContainer> listfiledetai = new List <FileContainer>(); foreach (string item in dsDeThi) { listfiledetai.Add(new FileContainer(item, this.clientpath)); } if (dsDeThi.Count == 1) { FileContainer dethi = listfiledetai[0]; foreach (Socket clientsock in ListClient) { ServerResponse response = new ServerResponse(ServerResponseType.PhatDe, dethi); clientsock.Send(response.Serialize()); } } if (dsDeThi.Count > 1) { int soluongde = dsDeThi.Count; int detruoc = 0; int desau = 0; foreach (Socket item in ListClient) { do { Random rd = new Random(); desau = rd.Next(0, soluongde); } while (detruoc == desau); detruoc = desau; FileContainer dethi = listfiledetai[desau]; ServerResponse response = new ServerResponse(ServerResponseType.PhatDe, dethi); item.Send(response.Serialize()); } } }