public static void Main(string[] args) { string server = SERVER; int port = PORT; RandomMover rm = new RandomMover(); Point p = new Point(); rm.id = 0; p.x = 99; p.y = 99; rm.pos = p; rm.MoveOnePos(2); CommunicatorJSON cJson = new CommunicatorJSON(); if (args.Length > 1) { if (IsInteger(args [1])) //we have only the port specified { port = System.Convert.ToUInt16(args [1]); } else { server = args [1]; } if (args.Length > 2) { if (!IsInteger(args[2])) { Console.WriteLine("Use me like this: %s [server] [port]", args[0]); } } } string httpLoc = "http://" + server + ":" + port; cJson.SetServer(httpLoc); try { Console.WriteLine(cJson.SendRepresentation(ref rm)); } catch (Exception ex) { Console.Out.WriteLine("[ERROR] - {0}", ex.Message); } for (int i = 0; i < 500; i++) { System.Threading.Thread.Sleep(500); rm.MoveOnePos(rm.RandomizeThree()); //Console.WriteLine (rm.ToString ()); try { Console.WriteLine(cJson.SendRepresentation(ref rm)); } catch (Exception ex) { Console.Out.WriteLine("[ERROR] - {0}", ex.Message); } } }