diff --git a/Galactic Colors Control Server/Commands/ConnectCommand.cs b/Galactic Colors Control Server/Commands/ConnectCommand.cs
index be467a4..34ff25a 100644
--- a/Galactic Colors Control Server/Commands/ConnectCommand.cs
+++ b/Galactic Colors Control Server/Commands/ConnectCommand.cs
@@ -24,7 +24,7 @@ namespace Galactic_Colors_Control_Server.Commands
//args[1] = args[1][0].ToString().ToUpper()[0] + args[1].Substring(1);
Program.clients[soc].pseudo = args[1];
Utilities.Send(soc, "Identified as " + args[1], Utilities.dataType.message);
- Utilities.Broadcast(args[1] + "joined the server", Utilities.dataType.message);
+ Utilities.Broadcast(args[1] + " joined the server", Utilities.dataType.message);
Logger.Write("Identified as " + Utilities.GetName(soc) + " form " + ((IPEndPoint)soc.LocalEndPoint).Address.ToString(), Logger.logType.info);
}
diff --git a/Galactic Colors Control Server/Commands/HelpCommand.cs b/Galactic Colors Control Server/Commands/HelpCommand.cs
index 780cafb..de14d7f 100644
--- a/Galactic Colors Control Server/Commands/HelpCommand.cs
+++ b/Galactic Colors Control Server/Commands/HelpCommand.cs
@@ -11,8 +11,8 @@ namespace Galactic_Colors_Control_Server.Commands
public string DescText { get { return "Shows the help."; } }
public string HelpText { get { return "Use /help [command] to display command help."; } }
public bool IsServer { get { return true; } }
- public bool IsClient { get { return false; } }
- public bool IsNoConnect { get { return true; } }
+ public bool IsClient { get { return true; } }
+ public bool IsNoConnect { get { return false; } }
public int minArgs { get { return 0; } }
public int maxArgs { get { return 1; } }
diff --git a/Galactic Colors Control Server/Commands/Manager.cs b/Galactic Colors Control Server/Commands/Manager.cs
index 4a7e891..701cb1b 100644
--- a/Galactic Colors Control Server/Commands/Manager.cs
+++ b/Galactic Colors Control Server/Commands/Manager.cs
@@ -45,12 +45,12 @@ namespace Galactic_Colors_Control_Server.Commands
}
else
{
- Utilities.Return("Unknown command", soc, server);
+ Utilities.Return("Unknown command : " + args[0], soc, server);
}
}
else
{
- Utilities.Return("Unknown command", soc, server);
+ Utilities.Return("Unknown command : " + args[0], soc, server);
}
}
@@ -64,7 +64,7 @@ namespace Galactic_Colors_Control_Server.Commands
{
if (command.IsClient)
{
- if(Utilities.IsConnect(soc))
+ if(!Utilities.IsConnect(soc))
{
return command.IsNoConnect;
}
diff --git a/Galactic Colors Control Server/Commands/PingCommand.cs b/Galactic Colors Control Server/Commands/PingCommand.cs
new file mode 100644
index 0000000..c651c65
--- /dev/null
+++ b/Galactic Colors Control Server/Commands/PingCommand.cs
@@ -0,0 +1,21 @@
+using System.Net.Sockets;
+
+namespace Galactic_Colors_Control_Server.Commands
+{
+ public class PingCommand : ICommand
+ {
+ public string Name { get { return "ping"; } }
+ public string DescText { get { return "Clears the console screen."; } }
+ public string HelpText { get { return "Use /ping to display our ping."; } }
+ public bool IsServer { get { return false; } }
+ public bool IsClient { get { return true; } }
+ public bool IsNoConnect { get { return false; } }
+ public int minArgs { get { return 0; } }
+ public int maxArgs { get { return 0; } }
+
+ public void Execute(string[] args, Socket soc, bool server = false)
+ {
+ Utilities.Return("It's a client side command" ,soc ,server);
+ }
+ }
+}
diff --git a/Galactic Colors Control Server/Galactic Colors Control Server.csproj b/Galactic Colors Control Server/Galactic Colors Control Server.csproj
index 7da9eb8..fe366b8 100644
--- a/Galactic Colors Control Server/Galactic Colors Control Server.csproj
+++ b/Galactic Colors Control Server/Galactic Colors Control Server.csproj
@@ -53,6 +53,7 @@
+
@@ -77,6 +78,7 @@
Designer
+ PreserveNewest
diff --git a/Galactic Colors Control/Program.cs b/Galactic Colors Control/Program.cs
index e8047ca..f13d6c0 100644
--- a/Galactic Colors Control/Program.cs
+++ b/Galactic Colors Control/Program.cs
@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Net;
+using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
@@ -149,11 +150,36 @@ namespace Galactic_Colors_Control_Client
private static void SendRequest()
{
string request = Console.ReadLine();
- Send(request, dataType.message);
-
- if (request.ToLower() == "/exit")
+ switch (request.ToLower())
{
- Exit();
+ case "/exit":
+ Exit();
+ break;
+
+ case "/ping":
+ Ping();
+ break;
+
+ default:
+ Send(request, dataType.message);
+ break;
+ }
+ }
+
+ private static void Ping()
+ {
+ Ping p = new Ping();
+ PingReply r;
+
+ r = p.Send(IP);
+
+ if (r.Status == IPStatus.Success)
+ {
+ Console.WriteLine(r.RoundtripTime.ToString() + " ms.");
+ }
+ else
+ {
+ Console.WriteLine("Time out");
}
}