private void handleIntefaceEvents(object sender, ServerToolsEvent e) { switch (e.Type) { case ServerToolsEvent.typeEvent.MESSAGE: appendTextToLog("Message from client number " + e.Id + " received!" + Environment.NewLine); appendTextToLog("Operation asked : " + e.Operation + Environment.NewLine); //TODO: décoder les paramètres + faire la réponse et l'envoyer break; case ServerToolsEvent.typeEvent.INFORMATION: if (e.Id == -1) { appendTextToLog("Error! The server cannot start!" + Environment.NewLine); btn_start.Enabled = true; btn_stop.Enabled = false; } else { appendTextToLog("Server successfully started on port " + port_local + " !" + Environment.NewLine); } break; case ServerToolsEvent.typeEvent.DECONNEXION: appendTextToLog("Client number " + e.Id + " disconnected!" + Environment.NewLine); break; case ServerToolsEvent.typeEvent.CONNEXION: appendTextToLog("Client number " + e.Id + " connected!" + Environment.NewLine); break; } }
private void handleIntefaceEvents(object sender, ServerToolsEvent e) { switch (e.Type) { case ServerToolsEvent.typeEvent.MESSAGE: appendTextToLog("Message from client number " + e.Id + " received!" + Environment.NewLine); appendTextToLog("Operation asked : " + e.Operation + Environment.NewLine); mySelfServer.handleRequest(e, typeof(ServiceEcho), service); break; case ServerToolsEvent.typeEvent.INFORMATION: if (e.Id == -1) { appendTextToLog("Error! The server cannot start!" + Environment.NewLine); btn_start.Enabled = true; btn_stop.Enabled = false; } else { appendTextToLog("Server successfully started on port " + port_local + " !" + Environment.NewLine); } break; case ServerToolsEvent.typeEvent.DECONNEXION: appendTextToLog("Client number " + e.Id + " disconnected!" + Environment.NewLine); break; case ServerToolsEvent.typeEvent.CONNEXION: appendTextToLog("Client number " + e.Id + " connected!" + Environment.NewLine); break; } }
private void handleInterfaceEvents(object sender, ServerToolsEvent e) { switch (e.Type) { case ServerToolsEvent.typeEvent.MESSAGE: AppendTextToLog("Message from client number " + e.Id + " received!" + Environment.NewLine); if (e.Operation != "") { AppendTextToLog("Operation asked : " + e.Operation + Environment.NewLine); mySelf.handleRequest(e, typeof(ServiceCatalogue), catalogue_name); } else if (e.Param[0] == DataUtils.ACKNOWLEDGE_PRESENCE_CODE) { AppendTextToLog("Client number " + e.Id + " still here!" + Environment.NewLine); } else { AppendTextToLog("Client number " + e.Id + " sent an empty message!" + Environment.NewLine); } break; case ServerToolsEvent.typeEvent.INFORMATION: if (e.Id == -1) { AppendTextToLog("Error! The server cannot connect!" + Environment.NewLine); btn_start.Enabled = true; btn_stop.Enabled = false; } else { AppendTextToLog("Server successfully started on port " + port_catalogue + " !" + Environment.NewLine); } break; case ServerToolsEvent.typeEvent.DECONNEXION: AppendTextToLog("Client number " + e.Id + " disconnected!" + Environment.NewLine); UnregisterById(e.Id); break; case ServerToolsEvent.typeEvent.CONNEXION: AppendTextToLog("Client number " + e.Id + " connected!" + Environment.NewLine); break; } }