Esempio n. 1
0
 /// <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();
 }
Esempio n. 2
0
        /// <summary>
        /// Changes communication way of this application.
        /// So, a receiver may want to do not receive messages anymore by changing it's communication way to 'Send'.
        /// </summary>
        /// <param name="newCommunicationWay">New communication way</param>
        private void ChangeCommunicationWay(CommunicationWays newCommunicationWay)
        {
            if (_communicationChannel == null ||
                _communicationChannel.State != CommunicationStates.Connected ||
                _communicationChannel.CommunicationWay == newCommunicationWay)
            {
                return;
            }

            _communicationChannel.SendMessage(
                new MDSChangeCommunicationWayMessage
            {
                NewCommunicationWay = newCommunicationWay
            });
            _communicationChannel.CommunicationWay = newCommunicationWay;
        }
 /// <summary>
 /// Deserializes this message.
 /// </summary>
 /// <param name="deserializer">Deserializer used to deserialize objects</param>
 public override void Deserialize(IMDSDeserializer deserializer)
 {
     base.Deserialize(deserializer);
     NewCommunicationWay = (CommunicationWays) deserializer.ReadByte();
 }
Esempio n. 4
0
 /// <summary>
 /// Deserializes this message.
 /// </summary>
 /// <param name="deserializer">Deserializer used to deserialize objects</param>
 public override void Deserialize(IMDSDeserializer deserializer)
 {
     base.Deserialize(deserializer);
     NewCommunicationWay = (CommunicationWays)deserializer.ReadByte();
 }
Esempio n. 5
0
        /// <summary>
        /// Changes communication way of this application.
        /// So, a receiver may want to do not receive messages anymore by changing it's communication way to 'Send'.
        /// </summary>
        /// <param name="newCommunicationWay">New communication way</param>
        private void ChangeCommunicationWay(CommunicationWays newCommunicationWay)
        {
            if (_communicationChannel == null || 
                _communicationChannel.State != CommunicationStates.Connected ||
                _communicationChannel.CommunicationWay == newCommunicationWay)
            {
                return;
            }

            _communicationChannel.SendMessage(
                new NGRIDChangeCommunicationWayMessage
                    {
                        NewCommunicationWay = newCommunicationWay
                    });
            _communicationChannel.CommunicationWay = newCommunicationWay;
        }
Esempio n. 6
0
 /// <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();
 }