public void sendMessage(string msg)
 {
     TcpIPClientModel cm = new TcpIPClientModel();
     cm.OpenCommPort(physicalHost, physicalPort);
     cm.SendMsg(msg);
     cm.close();
 }
        public void forwardMessage(object sender, MessageEventArgs e)
        {
            LogModel.LogMessage("Forwarding: " + e.Data, this.frameworkHost + ":" + this.frameworkPort ,ELogflag.LOG, "Forward Message");

            Stats.AddMessage(new LogEventArgs(this.frameworkHost + ":" + this.frameworkPort, DateTime.Now, "Message Received", "Log", e.Data));
            string msg = applyFaults(e.Data);
            if (msg != null)
            {
                TcpIPClientModel cm = new TcpIPClientModel();
                cm.OpenCommPort(physicalHost, physicalPort);
                cm.SendMsg(msg);
                cm.close();
                if (Faults.DuplicateMessage)
                {
                    cm = new TcpIPClientModel();
                    cm.OpenCommPort(physicalHost, physicalPort);
                    cm.SendMsg(msg);
                    cm.close();
                }
                if(Faults.ReverseOrderMessage)
                {
                    cm = new TcpIPClientModel();
                    cm.OpenCommPort(physicalHost, physicalPort);
                    cm.SendMsg(Faults.PreviousMessage);
                    cm.close();
                    if (Faults.DuplicateMessage)
                    {
                        cm = new TcpIPClientModel();
                        cm.OpenCommPort(physicalHost, physicalPort);
                        cm.SendMsg(Faults.PreviousMessage);
                        cm.close();
                    }
                    Faults.PreviousMessage = null;
                }

            }
        }