static void Main(string[] args) { bool t = false; while (!t) { Console.WriteLine("What Protocol Type Do you want to use"); Console.WriteLine(" 1 : TCP"); Console.WriteLine(" 2 : UDP"); Console.WriteLine("Press 1 or 2"); int choose = Convert.ToInt32(Console.ReadLine()); if (choose == 1) { t = true; MyTCPClient tcp = new MyTCPClient(); tcp.CreateClient(); } else if (choose == 2) { t = true; MyUDPClient udp = new MyUDPClient(); udp.CreateClient(); } } }
static void Main(string[] args) { Thread.Sleep(1000); var clt = new MyTCPClient("localhost", 90); clt.SendMessage(Encoding.UTF8.GetBytes("Hi!")); Console.WriteLine("MessageSent."); Console.ReadLine(); }