static void Main(string[] args) { objClient.Init(); send = new Thread(new ThreadStart(Send)); receive = new Thread(new ThreadStart(Receive)); send.Start(); receive.Start(); Console.ReadLine(); }
static void Main(string[] args) { try { ObjectClient <Animals> objClient = new ObjectClient <Animals>("127.0.0.1", 16059, true); objClient.Init(); while (true) { while (objClient.ReceiveObject().Count != 0) { Animals animals = (Animals)objClient.ReceiveObject().Dequeue(); //Console.WriteLine(animals); Console.WriteLine("name: " + animals.name + " height: " + animals.height + " sex: " + animals.sex); } } } catch (Exception e) { Console.WriteLine(e.Message); } }