BitSharp.Network.RemoteReceiver.Listen C# (CSharp) Method

Listen() public method

public Listen ( ) : void
return void
        public void Listen()
        {
            Task.Factory.StartNew(async () =>
            {
                try
                {
                    while (true)
                    {
                        var messageStart = await ReceiveExactly(4);
                        await HandleMessage(messageStart);
                    }
                }
                catch (Exception ex)
                {
                    if (!(ex is ObjectDisposedException))
                        logger.Error(ex, "Peer failed handling message.");

                    Fail(ex);
                }
            }, TaskCreationOptions.LongRunning);
        }