Res.Core.TcpTransport.NetworkIO.TcpGateway.ReceiveMessage C# (CSharp) Method

ReceiveMessage() public method

public ReceiveMessage ( ) : bool
return bool
        public bool ReceiveMessage()
        {
            try
            {
                if (_socket.Poll(TimeSpan.FromSeconds(0)))
                    return true;
            }
            catch (OperationCanceledException)
            {
                Log.Info("[TcpGateway] Cancellation signal received...exiting");
                throw;
            }
            catch (TerminatingException)
            {
                Log.Info("[TcpGateway] Context terminated...exiting");
                throw;
            }
            catch (Exception e)
            {
                Log.Warn("[TcpGateway] Error from mainloop...exiting", e);
                throw;
            }

            return false;
        }

Usage Example

示例#1
0
 private static bool receiveMessage(TcpGateway gateway)
 {
     bool newRequest = gateway.ReceiveMessage();
     return newRequest;
 }