Exemplo n.º 1
0
    void CommunicationLoop()
    {
        Socket s = null;

        try
        {
            Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            s.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1337));
            working = true;
        }
        catch (Exception ex)
        {
            working = false;
        }
        while (working)
        {
            lock ( syncRoot )
            {
                while (_messages.Count > 0)
                {
                    Message       message = _messages.Dequeue();
                    MessageResult result  = message.Process(s);
                    result.Notify();
                }
            }
            Thread.Sleep(100);
        }
    }