コード例 #1
0
ファイル: CommunicatorBase.cs プロジェクト: ashwinrath/NGRID
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="comminicatorId">Unique identifier for this communicator.</param>
 protected CommunicatorBase(long comminicatorId)
 {
     ComminicatorId = comminicatorId;
     CommunicationWay = CommunicationWays.Send;
     _state = CommunicationStates.Closed;
     _sendLock = new object();
 }
コード例 #2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="comminicatorId">Unique identifier for this communicator.</param>
 protected CommunicatorBase(long comminicatorId)
 {
     ComminicatorId   = comminicatorId;
     CommunicationWay = CommunicationWays.Send;
     _state           = CommunicationStates.Closed;
     _sendLock        = new object();
 }
コード例 #3
0
ファイル: TCPChannel.cs プロジェクト: erisonliang/NGRID
 /// <summary>
 /// Creates a new TCPChannel object.
 /// </summary>
 /// <param name="ipAddress">IP address of NGRID server</param>
 /// <param name="port">TCP port of NGRID server</param>
 public TCPChannel(string ipAddress, int port)
 {
     _ipAddress       = ipAddress;
     _port            = port;
     _state           = CommunicationStates.Closed;
     CommunicationWay = CommunicationWays.SendAndReceive;
     _wireProtocol    = new NGRIDDefaultWireProtocol();
     _sendLock        = new object();
 }
コード例 #4
0
ファイル: TCPChannel.cs プロジェクト: erisonliang/NGRID
        /// <summary>
        /// Changes the state of the client and raises StateChanged event.
        /// </summary>
        /// <param name="newState">New state</param>
        private void ChangeState(CommunicationStates newState)
        {
            var oldState = _state;

            _state = newState;
            if (StateChanged != null)
            {
                StateChanged(this, new CommunicationStateChangedEventArgs {
                    OldState = oldState
                });
            }
        }
コード例 #5
0
        /// <summary>
        /// Changes the state of the communicator and raises event
        /// </summary>
        /// <param name="newState">New state</param>
        protected void OnChangeState(CommunicationStates newState)
        {
            var oldState = _state;

            _state = newState;
            if (StateChanged != null)
            {
                StateChanged(this, new CommunicatorStateChangedEventArgs {
                    Communicator = this, OldState = oldState
                });
            }
        }
コード例 #6
0
 /// <summary>
 ///     ֹͣ
 /// </summary>
 public void Abort()
 {
     try
     {
         _communicationState = CommunicationStates.Closing;
         InnerAbort();
         _communicationState = CommunicationStates.Closed;
     }
     catch (System.Exception ex)
     {
         _communicationState = CommunicationStates.Faulte;
         _tracing.Error(ex, null);
         FaultedHandler(null);
         throw;
     }
 }
コード例 #7
0
 /// <summary>
 ///     ´ò¿ª
 /// </summary>
 public void Open()
 {
     try
     {
         _communicationState = CommunicationStates.Opening;
         OpeningHandler(null);
         InnerOpen();
         _communicationState = CommunicationStates.Opened;
         OpenedHandler(null);
     }
     catch (System.Exception ex)
     {
         _communicationState = CommunicationStates.Faulte;
         _tracing.Error(ex, null);
         FaultedHandler(null);
         throw;
     }
 }
コード例 #8
0
ファイル: TCPChannel.cs プロジェクト: zjxbetter/DotNetMQ
 /// <summary>
 /// Changes the state of the client and raises StateChanged event.
 /// </summary>
 /// <param name="newState">New state</param>
 private void ChangeState(CommunicationStates newState)
 {
     var oldState = _state;
     _state = newState;
     if (StateChanged != null)
     {
         StateChanged(this, new CommunicationStateChangedEventArgs { OldState = oldState });
     }
 }
コード例 #9
0
ファイル: TCPChannel.cs プロジェクト: zjxbetter/DotNetMQ
 /// <summary>
 /// Creates a new TCPChannel object.
 /// </summary>
 /// <param name="ipAddress">IP address of MDS server</param>
 /// <param name="port">TCP port of MDS server</param>
 public TCPChannel(string ipAddress, int port)
 {
     _ipAddress = ipAddress;
     _port = port;
     _state = CommunicationStates.Closed;
     CommunicationWay = CommunicationWays.SendAndReceive;
     _wireProtocol = new MDSDefaultWireProtocol();
     _sendLock = new object();
 }
コード例 #10
0
ファイル: CommunicatorBase.cs プロジェクト: ashwinrath/NGRID
 /// <summary>
 /// Changes the state of the communicator and raises event
 /// </summary>
 /// <param name="newState">New state</param>
 protected void OnChangeState(CommunicationStates newState)
 {
     var oldState = _state;
     _state = newState;
     if (StateChanged != null)
     {
         StateChanged(this, new CommunicatorStateChangedEventArgs {Communicator = this, OldState = oldState});
     }
 }