Skip to content
Snippets Groups Projects
Commit e3ea94ce authored by ZIMMERLÉ Nathan's avatar ZIMMERLÉ Nathan
Browse files

Résolution de conflits

parent 00c9efa5
No related merge requests found
...@@ -12,7 +12,7 @@ namespace ClientUdp ...@@ -12,7 +12,7 @@ namespace ClientUdp
class ClientUdp class ClientUdp
{ {
const int MsgsBufferSize = 100000000; const int MsgsBufferSize = 100000000;
static string serverIP = "127.0.0.1"; // A changer static string serverIP = "130.79.81.194"; // A changer
static int serverPort = 17021; // A changer static int serverPort = 17021; // A changer
static string messages = ""; static string messages = "";
static volatile bool threadIsRunning; static volatile bool threadIsRunning;
...@@ -83,6 +83,8 @@ namespace ClientUdp ...@@ -83,6 +83,8 @@ namespace ClientUdp
int nBytes = clientSocket.ReceiveFrom(bufferGet, bufferGet.Length, SocketFlags.None, ref serverEP); int nBytes = clientSocket.ReceiveFrom(bufferGet, bufferGet.Length, SocketFlags.None, ref serverEP);
// Désérialisation de la chaîne comportant les messages avec pseudo // Désérialisation de la chaîne comportant les messages avec pseudo
messages = System.Text.Encoding.ASCII.GetString(bufferGet, 0, nBytes); messages = System.Text.Encoding.ASCII.GetString(bufferGet, 0, nBytes);
displayMsgs();
displayMenu();
} }
while (threadIsRunning); while (threadIsRunning);
} }
...@@ -99,6 +101,16 @@ namespace ClientUdp ...@@ -99,6 +101,16 @@ namespace ClientUdp
} }
} }
static void displayMenu()
{
// Affichage du menu
Console.WriteLine("1. Envoyer un message");
Console.WriteLine("2. Demander messages");
Console.WriteLine("3. S'abonner");
Console.WriteLine("4. Se désabonner");
Console.Write("Votre choix : ");
}
static void Main(string[] args) static void Main(string[] args)
{ {
try try
...@@ -117,16 +129,10 @@ namespace ClientUdp ...@@ -117,16 +129,10 @@ namespace ClientUdp
// Affichage des messages // Affichage des messages
Thread.Sleep(500); Thread.Sleep(500);
displayMsgs(); displayMsgs();
displayMenu();
// Affichage du menu
Console.WriteLine("1. Envoyer un message");
Console.WriteLine("2. Demander messages");
Console.WriteLine("3. S'abonner");
Console.WriteLine("4. Se désabonner");
Console.Write("Votre choix : ");
string choice = Console.ReadLine(); string choice = Console.ReadLine();
displayMsgs();
// Traitement du choix du menu // Traitement du choix du menu
switch (choice) switch (choice)
{ {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment