示例#1
0
        static void Main(string[] args)
        {
            AsyncSocket asyncSocket = new AsyncSocket(numTentativas: 2);

            asyncSocket.OnDataArrival += AsyncSocket_OnPrecisaTratarDados;
            asyncSocket.OnDisconnect  += AsyncSocket_OnSinalizaDesconexao;

            asyncSocket.StartListening("127.0.0.1", 1733);

            bool quit = false;

            while (!quit)
            {
                string x = Console.ReadLine();
                if (!string.IsNullOrEmpty(x) && x != "quit")
                {
                    //send to all conected devices
                    asyncSocket.Broadcast(x);
                }
                else
                {
                    quit = true;
                }
            }
        }