static void Main(string[] args) { try { int port_addr = Int32.Parse(args[0]); Console.Title = "Child Builder " + port_addr.ToString(); ChildBuilder cBuilder = new ChildBuilder(port_addr); //starts child builder at port address given by mother builder if (cBuilder.comm.sndr.getReadyblockingQ_size() <= 0) { CommMessage msg = new CommMessage(CommMessage.MessageType.BuildRequest); string remoteEndPoint = Comm <ChildBuilder> .makeEndPoint("http://localhost", 8082, "MotherBuilder"); msg.to = remoteEndPoint; msg.from = cBuilder.endPoint; msg.command = "ready"; msg.body = port_addr.ToString(); cBuilder.comm.sndr.PostMessage(msg); //sends ready message to mother builder cBuilder.comm.sndr.PostReadyMessage(msg); Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("\nMessage Sent from ChildBuilder to MotherBuilder. Purpose - At start after spawning, sends ready msg to mother builder to accept next buildrequest"); Console.ResetColor(); msg.show(); } } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadKey(); }
//Main method in ChildBuilder Class but as For No receiver it will not work static void Main(string[] args) { try { ChildBuilder cb = new ChildBuilder(Int32.Parse(args[0])); cb.getMessege(); } catch (Exception e) { Console.WriteLine("Exception Occured:" + e.Message); } }
static void Main(string[] args) { int port; if (args.Count() == 0) { Console.Title = "Child Builder"; Console.Write("\n please enter integer value on command line"); return; } else { Console.Title = "Child Builder"; port = Int32.Parse(args[0]); ChildBuilder child = new ChildBuilder(port); } Console.WriteLine("Press any key"); Console.ReadKey(); }