Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Console.WriteLine(" ___    ___ ___   ___  ___      ___ ___  _______   ________          ________  _______   ________  ___      ___ _______   ________     ");
            Console.WriteLine(@"|\  \  /  /|\  \ |\  \|\  \    /  /|\  \|\  ___ \ |\   __  \        |\   ____\|\  ___ \ |\   __  \|\  \    /  /|\  ___ \ |\   __  \    ");
            Console.WriteLine(@"\ \  \/  / | \  \\_\  \ \  \  /  / | \  \ \   __/|\ \  \|\  \       \ \  \___|\ \   __/|\ \  \|\  \ \  \  /  / | \   __/|\ \  \|\  \   ");
            Console.WriteLine(@" \ \    / / \ \______  \ \  \/  / / \ \  \ \  \_|/_\ \   _  _\       \ \_____  \ \  \_|/_\ \   _  _\ \  \/  / / \ \  \_|/_\ \   _  _\  ");
            Console.WriteLine(@"  /     \/   \|_____|\  \ \    / /   \ \  \ \  \_|\ \ \  \\  \|       \|____|\  \ \  \_|\ \ \  \\  \\ \    / /   \ \  \_|\ \ \  \\  \| ");
            Console.WriteLine(@" /  /\   \          \ \__\ \__/ /     \ \__\ \_______\ \__\\ _\         ____\_\  \ \_______\ \__\\ _\\ \__/ /     \ \_______\ \__\\ _\ ");
            Console.WriteLine(@"/__/ /\ __\          \|__|\|__|/       \|__|\|_______|\|__|\|__|       |\_________\|_______|\|__|\|__|\|__|/       \|_______|\|__|\|__|");
            Console.WriteLine(@"|__|/ \|__|                                                            \|_________|                                                    ");

            Task.Factory.StartNew(() =>
            {
                Console.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "> Iniciando servidor");
                serverUDP = new UDPListener("192.168.0.100", 7172, 1024, Server_OnAcceptHandler, Server_OnReceiveHandler);
                serverUDP.StartServer();

                serverTCP = new TCPListener("192.168.0.100", 7171, 1024, Server_OnAcceptHandler, Server_OnReceiveHandler, Server_OnDisconnectHandler);
                serverTCP.StartServer();

                Console.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + "> Servidor iniciado");
            });

            while (Console.ReadLine() != "fim")
            {
            }
            ;
        }
Exemplo n.º 2
0
        public UserInputPage(MainWindow mainForm)
        {
            InitializeComponent();
            _mainForm = mainForm;
            TbMemberId.Focus();

            if (Settings.Default.EnableTCPListener)
            {
                if (!UDPListener.ServerStarted)
                {
                    UDPListener.StartServer();
                }
            }

            UDPListener.UserDataReceived += UDPListener_UserDataReceived;;
        }