Exemplo n.º 1
0
        public void StartListen()
        {
            String message = "";

            while (true)
            {
                //Console.Write("Enter message: ");
                //message = Console.ReadLine();             Here must be: message = info + SQL queryy;
                connection.SendObject("Message", message);
                connection.RemoveIncomingPacketHandler();
                connection.AppendIncomingPacketHandler <string>("Message", PrintIncomingMessage);
                Console.WriteLine("\nPress q to quit or any other key to send another message.");
                if (Console.ReadKey(true).Key == ConsoleKey.Q)
                {
                    break;
                }
            }
        }
Exemplo n.º 2
0
        public void Connect()
        {
            net   = new Network();
            print = new Display();
            ConnectionInfo connInfo   = new ConnectionInfo("127.0.0.1", 2222);
            Connection     newTCPConn = TCPConnection.GetConnection(connInfo);

            newTCPConn.AppendIncomingPacketHandler <Network>("Network", PrintIncomingMessage);
            newTCPConn.AppendShutdownHandler(OnConnectionClosed);
            Thread.Sleep(100);
            while (true)
            {
                ;
            }
        }