Ejemplo n.º 1
0
        public void SendSMS(string CELL_Number, string SMS_Message)
        {
            SmsSubmitPdu pdu1;

            if (comm.IsConnected() == true)
            {
                pdu1 = new SmsSubmitPdu(SMS_Message, CELL_Number, "");

                comm.SendMessage(pdu1);
                comm.Close();
            }
        }
Ejemplo n.º 2
0
        public bool checkGSMConected()
        {
            bool status = false;

            if (comm != null)
            {
                if (comm.IsConnected() == true)
                {
                    return(true);
                }
            }
            return(status);
        }
Ejemplo n.º 3
0
        public void Check_Connection(string port)
        {
            if (port.Length < 4)
            {
                return;
            }

            if (comm.IsOpen())
            {
                comm.Close();
            }
            comm = new GsmCommMain(port, baudrate, timeout);

            if (!comm.IsConnected())
            {
                try
                {
                    comm.Open();
                    connected = true;
                    return;
                }
                catch (Exception ex)
                {
                    connected = false;
                }
            }
            else
            {
                connected = true;
            }
        }
Ejemplo n.º 4
0
        public void Send(string message, string nr)
        {
            SmsSubmitPdu pdu = new SmsSubmitPdu(message, nr, "");

            try
            {
                if (!comm.IsOpen())
                {
                    comm.Open();
                }

                if (!comm.IsConnected())
                {
                    Singleton.Show_MessageBox("błąd portu");
                    return;
                }

                /*if (comm.GetPinStatus() != PinStatus.Ready) {
                 *  comm.EnterPin(PIN);
                 *  Thread.Sleep(1000);
                 * }*/

                comm.SendMessage(pdu);
                Thread.Sleep(1000);
            }
            catch (Exception ex)
            {
                Singleton.Show_MessageBox(ex.Message);
                return;
            }
            //Singleton.Show_MessageBox("wysyłam " + message + "na numer: " + nr);
        }
Ejemplo n.º 5
0
        public List <string> GetConnectedPort()
        {
            List <string> ConnectedPorts = new List <string>();

            string[] port = System.IO.Ports.SerialPort.GetPortNames();
            foreach (string st in port)
            {
                comm = new GsmCommMain(st, 19200, 300);
                try
                {
                    comm.Open();
                    if (comm.IsConnected())
                    {
                        //Console.WriteLine("BhattiConsole: Modem Connected Successfully " + st);
                        ConnectedPorts.Add(st);
                        comm.Close();
                    }
                    else
                    {
                        // Console.WriteLine("BhattiConsole: Modem noy Connected " + st);
                        comm.Close();
                    }
                }
                catch (Exception ex)
                {
                    // Console.WriteLine("BhattiConsole: " + ex.Message);
                }
            }
            return(ConnectedPorts);
        }
Ejemplo n.º 6
0
 //Méthode pour tester la configuration des ports
 public void Test_port(Label infomodem)
 {
     Cursor.Current = Cursors.WaitCursor;
     comm           = new GsmCommMain(port, baudRate, timeout);
     try
     {
         comm.Open();
         if (!comm.IsConnected())
         {
             Cursor.Current = Cursors.Default;
             infomodem.Text = "La connexion au peripherique mobile a echoué.";
             if (infomodem.Text == "La connexion au peripherique mobile a echoué.")
             {
                 comm.Close();
                 return;
             }
             Cursor.Current = Cursors.WaitCursor;
         }
         else
         {
             infomodem.Text = "Successfully connected to the phone.";
             comm.Close();
         }
     }
     catch (Exception)
     {
         new Error("Branchez un Modem SVP...").ShowDialog();
         return;
     }
 }
Ejemplo n.º 7
0
 private void vistaButton2_Click(object sender, EventArgs e)
 {
     try
     {
         main = new MainForm();
         comm = new GsmCommMain(int.Parse(comboBox1.Text), 9600, 300);
         comm.Open();
         if (comm.IsConnected() == true)
         {
             MessageBox.Show("Koneksi Suksess !!", "Information !!", MessageBoxButtons.OK, MessageBoxIcon.Information);
             main.Port = comboBox1.Text;
             main.Show();
             this.Hide();
         }
         else
         {
             MessageBox.Show("Tidak Ada port yang terbuka !!!\n " +
                             "Cek kembali bluetooth Anda !", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         comm.Close();
         main.Show();
         this.Hide();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Ejemplo n.º 8
0
        public bool Connect(int comPort, int baudRate, int timeout)
        {
            try
            {
                Gsm = new GsmCommMain(comPort, baudRate, timeout);

                if (!Gsm.IsOpen())
                {
                    Gsm.Open();
                }

                return(true);
            }
            catch (System.Exception ex)
            {
                LogError(ex.Message);

                if (Gsm.IsConnected() && Gsm.IsOpen())
                {
                    Gsm.Close();
                }

                return(false);
            }
        }
Ejemplo n.º 9
0
        public static bool connects()
        {
            cmbCOM = "COM4";
            comm   = new GsmCommMain(cmbCOM, 9600, 150);
            Console.WriteLine(cmbCOM);

            if (comm.IsConnected())
            {
                Console.WriteLine("comm is already open");
                state = true;
            }
            else
            {
                Console.WriteLine("comm is not open");
                try
                {
                    comm.Open();
                    state = true;
                }
                catch (Exception)
                {
                    state = false;
                }
            }

            Console.WriteLine(cmbCOM);
            return(state);
        }
Ejemplo n.º 10
0
        private void btnTesKoneksi_Click(object sender, EventArgs e)
        {
            var port     = "COM1"; // port yang digunakan menyesuaikan
            var baudRate = 9600;
            var timeout  = 150;

            comm = new GsmCommMain(port, baudRate, timeout);
            comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);

            try
            {
                comm.Open();

                while (!comm.IsConnected())
                {
                    var msgResult = MessageBox.Show(this, "No phone connected.", "Connection setup",
                                                    MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);

                    if (msgResult == DialogResult.Cancel)
                    {
                        comm.Close();
                        return;
                    }
                    else
                    {
                        comm.Close();
                        comm.Open();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Connection error: " + ex.Message, "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 11
0
        public static bool connects()
        {
            cmbCOM = "COM20";
            comm   = new GsmCommMain(cmbCOM, 9600, 150);
            Console.WriteLine(cmbCOM);

            if (comm.IsConnected())
            {
                MainForm._Form1.FeedBack("comm is already open");
                state = true;
            }
            else
            {
                Console.WriteLine("comm is not open");
                MainForm._Form1.FeedBack("comm is not open");
                try
                {
                    comm.Open();
                    state = true;
                }
                catch (Exception p)
                {
                    state = false;
                    MainForm._Form1.FeedBack(" Error" + p.Message.ToString());
                }
            }

            Console.WriteLine(cmbCOM);
            return(state);
        }
Ejemplo n.º 12
0
        public string set(string comPort, string baudRate)
        {
            string status = "";

            try
            {
                Comm_Port     = Convert.ToInt16("6");
                Comm_BaudRate = Convert.ToInt32(9600);
                Comm_TimeOut  = Convert.ToInt32(100);
                comm          = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);
            }
            catch (Exception E1)
            {
                MessageBox.Show("Error Converting COM Port Settings Values", "Check COM Port Values", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            comm = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);

            try
            {
                comm.Open();
                if (comm.IsConnected())
                {
                    MessageBox.Show("Connected Successfully To GSM Phone / Modem...!!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    status = "connected";
                }
            }
            catch (Exception E2)
            {
                MessageBox.Show("Error While Connecting To GSM Phone / Modem", "Information", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(status);
        }
Ejemplo n.º 13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            for (byte i = 0; i < 50; i++)
            {
                comm = new GsmCommMain((i + 1), 9600, 300);
                try
                {
                    comm.Open();
                    if (comm.IsConnected() == true)
                    {
                        comboBox1.Items.Add((i + 1));
                    }
                    comm.Close();
                }
                catch (Exception)
                {
                }
            }

            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            else
            {
                MessageBox.Show("Tidak Ada port yang terbuka !!!\n " +
                                "Cek kembali bluetooth Anda !", "Warning !!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 14
0
        private void btnTest_Click(object sender, System.EventArgs e)
        {
            if (!EnterNewSettings())
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            GsmCommMain comm = new GsmCommMain(portName, baudRate, timeout);

            try
            {
                comm.Open();
                while (!comm.IsConnected())
                {
                    Cursor.Current = Cursors.Default;
                    if (MessageBox.Show(this, "No phone connected.", "Connection setup",
                                        MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation) == DialogResult.Cancel)
                    {
                        comm.Close();
                        return;
                    }
                    Cursor.Current = Cursors.WaitCursor;
                }

                comm.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, "Connection error: " + ex.Message, "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            MessageBox.Show(this, "Successfully connected to the phone.", "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 15
0
        //Méthode pour tester la configuration des ports

        public void Test_port()
        {
            Cursor.Current = Cursors.WaitCursor;
            comm           = new GsmCommMain(port, baudRate, timeout);
            try
            {
                comm.Open();
                while (!comm.IsConnected())
                {
                    Cursor.Current = Cursors.Default;
                    MessageBox.Show("La connexion au peripherique mobile a echoué\nREESAYER?", "TEST DE CONNEXION");

                    if (MessageBox.Show("La connexion au peripherique mobile a echoué\nREESAYER?", "TEST DE CONNEXION") != DialogResult.Cancel)
                    {
                        comm.Close();
                        return;
                    }
                    Cursor.Current = Cursors.WaitCursor;
                }
                MessageBox.Show("Successfully connected to the phone.", "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
                comm.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Connection error: " + ex.Message, "Connection setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
        }
Ejemplo n.º 16
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            while (gsmComm.IsConnected())
            {
                var msgs = gsmComm.ReadMessages(PhoneMessageStatus.ReceivedUnread, "SM");
                Thread.Sleep(512);
                foreach (var msg in msgs)
                {
                    var sms = (SmsDeliverPdu)msg.Data;
                    worker.ReportProgress(0, sms.UserDataText);
                    gsmComm.DeleteMessage(msg.Index, msg.Storage);
                    Thread.Sleep(512);
                }
            }

            Debug.WriteLine("Worker Thread Terminated");
        }
        private void Send()
        {
            if (commMain != null && commMain.IsConnected())
            {
                try
                {
                    if (dataGridView_ClientList.SelectedRows.Count > 0)
                    {
                        string       cpNumber = dataGridView_ClientList.SelectedRows[0].Cells[4].Value.ToString();
                        SmsSubmitPdu pdu;
                        int          count    = 0;
                        int          countPos = 0;

                        foreach (char c in tb_message.Text)
                        {
                            count++;
                            if (count >= 150)
                            {
                                string firstFivChar = new string(tb_message.Text.Substring(countPos, count).ToArray());
                                pdu = new SmsSubmitPdu(firstFivChar, cpNumber, string.Empty);
                                commMain.SendMessage(pdu);
                                countPos = countPos + 150;
                                count    = count - count;
                            }
                        }

                        if (count <= 150)
                        {
                            string lastText = new string(tb_message.Text.Substring(countPos, count).ToArray());
                            pdu = new SmsSubmitPdu(lastText, cpNumber, "");
                            commMain.SendMessage(pdu);
                            countPos = countPos + 150;
                            count    = count - count;
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please selecet Client number");
                    }
                }
                catch (Exception)
                {
                    MessageBox.Show("Please check if simcard properly loaded. Please check if simcard have load.");
                }
            }
        }
Ejemplo n.º 18
0
        public static bool connect()
        {
            state = false;
            int d = 0;

            do
            {
                d++;
                cmbCOM = "COM" + d.ToString();
                comm   = new GsmCommMain(cmbCOM, 9600, 150);
                Console.WriteLine(cmbCOM);
                MainForm._Form1.FeedBack("COMM: " + cmbCOM);

                if (comm.IsConnected())
                {
                    MainForm._Form1.FeedBack("comm is already open");
                    Console.WriteLine("comm is already open");
                    state = true;
                    break;
                }
                else
                {
                    MainForm._Form1.FeedBack("comm is not open");
                    Console.WriteLine("comm is not open");
                    try
                    {
                        comm.Open();
                        state = true;
                    }
                    catch (Exception k)
                    {
                        MainForm._Form1.FeedBack("COMM: " + k.Message.ToString());

                        state = false;
                        continue;
                    }
                }
            }while (!comm.IsConnected() && d < 30);

            Console.WriteLine(cmbCOM);
            MainForm._Form1.FeedBack("COMM" + cmbCOM);
            return(state);
        }
Ejemplo n.º 19
0
 public void StartReceiving(int interval)
 {
     if (_gsm.IsConnected())
     {
         _rcvTimer           = new Timer(interval);
         _rcvTimer.AutoReset = true;
         _rcvTimer.Elapsed  += _rcvTimer_Elapsed;
         _rcvTimer.Start();
         Log.Add(LogLevel.Info, "SMS", "SMS receiving started.");
     }
     else
     {
         Log.Add(LogLevel.Error, "SMS", "Cannot start receiving SMS, not connected to Phone.");
     }
 }
Ejemplo n.º 20
0
 public Boolean IsModemConnected()
 {
     try
     {
         if (comm.IsConnected())
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(false);
 }
Ejemplo n.º 21
0
        public static bool connected(string network, string comms)
        {
            netName = network;

            comm = new GsmCommMain(comms, 9600, 150);

            try
            {
                if (comm.IsConnected())
                {
                    Console.WriteLine(netName + "comm is already open");
                    okay = true;
                    if (!comm2.IsConnected())
                    {
                        comm2 = new GsmCommMain(comms, 9600, 150);

                        comm2.Open();
                        CommNetwork _cm = new CommNetwork()
                        {
                            Names = netName, Comms = comm2
                        };
                        primes.Add(_cm);
                    }
                    else
                    {
                        Console.WriteLine(netName + "all comms are open comm is already open");
                    }
                }
                else
                {
                    comm.Open();
                    CommNetwork _cm = new CommNetwork()
                    {
                        Names = netName, Comms = comm
                    };
                    primes.Add(_cm);
                    Console.WriteLine(netName + "comm has connected");
                    okay = true;
                }
            }
            catch (Exception r)
            {
                Console.WriteLine("comm has failed");
                okay = false;
            }

            return(okay);
        }
Ejemplo n.º 22
0
 public void Close() //ref GsmCommMain comm
 {
     try
     {
         while (comm != null && (comm.IsConnected() || comm.IsOpen()))
         {
             //comm.ResetToDefaultConfig();
             //comm.ReleaseProtocol();
             comm.Close();
         }
     }
     catch (Exception)
     {
         ;
     }
     comm = null;
 }
Ejemplo n.º 23
0
        private void CheckConnection()
        {
            comm = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);

            comm.Open();
            if (comm.IsConnected())
            {
                ConnectionStatusMenuItem.Text = "Connected";
            }
            else
            {
                ConnectionStatusMenuItem.Text = "Not Connected";
            }

            comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);
            comm.EnableMessageNotifications();
        }
Ejemplo n.º 24
0
        public bool Connect()
        {
            comm = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);
            bool connected = false;

            comm.Open();

            if (comm.IsConnected())
            {
                Manufacturer = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                Model        = comm.IdentifyDevice().Model.ToUpper().ToString();
                Revision     = comm.IdentifyDevice().Revision.ToUpper().ToString();
                SerialNumber = comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                connected    = true;
                Debug.Write("Manufacturer " + Manufacturer + Environment.NewLine + "Model " + Model + Environment.NewLine + "Revision " + Revision + Environment.NewLine + "SerialNumber " + SerialNumber + Environment.NewLine + "connected " + connected.ToString());
            }
            return(connected);
        }
Ejemplo n.º 25
0
        public void Process()
        {
            while (true)
            {
                if (comm.IsConnected() == false)
                {
                    thread.Abort();

                    metroTextButton1.Enabled ^= true;
                    metroTextButton2.Enabled ^= true;
                    metroComboBox1.Enabled   ^= true;
                    richTextBox1.Clear();
                    MessageBox.Show("Communication is disconnected!");
                }

                //Read_message();
            }
        }
Ejemplo n.º 26
0
        public bool CrearConexionCOM()
        {
            bool retry = true;;

            do
            {
                comm = new GsmCommMain("COM" + puertoCOM, 9600, 150);
                try
                {
                    comm.Open();
                    if (comm.IsConnected())
                    {
                        //eventLog.WriteEntry("Conexion de BAM exitosa, señal del dispositivo: " + comm.GetSignalQuality().SignalStrength,EventLogEntryType.Information);
                        string nombreBAM      = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                        string modelBAM       = comm.IdentifyDevice().Model.ToUpper().ToString();
                        string numRevisionBAM = comm.IdentifyDevice().Revision.ToUpper().ToString();
                        string numSerieBAM    = comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                        new LogAplicacion().Info("Conexion de BAM exitosa, señal del dispositivo: " + comm.GetSignalQuality().SignalStrength
                                                 + "\n Datos BAM: \n *" + nombreBAM + "\n *" + modelBAM + "\n *" + numRevisionBAM + "\n *" + numSerieBAM
                                                 );
                        return(true);
                    }
                    else
                    {
                        comm.Close();
                        puertoCOM++;
                    }
                }
                catch (Exception ex)
                {
                    if (puertoCOM >= 50)//recorre hasta el puerto 50
                    {
                        NotificacionCorreo notificacionCorreo = new NotificacionCorreo();
                        Thread             thread             = new Thread(x => notificacionCorreo.EnviarThread("Verifique que la banda ancha (bam) este conectada al equipo..!!<br></br>Se recomienda cerrar la aplicacion e intentar de nuevo <br></br>Error: " + ex));
                        thread.Start();
                        new LogAplicacion().Error(ex.Message);
                        return(false);
                    }
                    puertoCOM++;
                    retry = true;
                }
            }while (retry);
            return(false);
        }
Ejemplo n.º 27
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        dbcon obj = new dbcon();

        obj.GetInvoice(Session["OrderID"].ToString());
        try
        {
            //  if (obj.GetInvoice())
            // {

            string MsgBody = dbcon.mymsg;      //myclass.body;
            //"using Gmail in ASP.NET";

            int         port = 8;
            int         baud = 9600;
            int         time = 300;
            GsmCommMain Rate = new GsmCommMain(port, baud, time);
            Rate.Open();

            while (!Rate.IsConnected())
            {
                lblexp.Text = "Not Connected";
            }
            //MessageBox.Show("Connected");
            // Rate.Close();
            SmsSubmitPdu Msg;



            Msg = new SmsSubmitPdu(MsgBody, dbcon.phoneno);
            Rate.SendMessage(Msg);
            //lblmobile.Text = "Message sent to  " + txtmobile.Text + "";
            Rate.Close();



            lblexp.Text = "Dear User Your Ordered Information is Sent";
            // }
        }
        catch (Exception ex)
        {
            lblexp.Text = "some Problem" + ex;
        }
    }
Ejemplo n.º 28
0
        public void connect()
        {
            string cmbCOM = "COM" + comms.Text;

            comm = new GsmCommMain(cmbCOM, 9600, 150);

            try
            {
                if (comm.IsConnected())
                {
                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.GetCurrentOperator();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSignalQuality();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSmscAddress();
                    info.Content    = info.Content + Environment.NewLine + comm.GetSubscriberNumbers();
                    save.Visibility = Visibility.Visible;


                    Console.WriteLine("comm is already open");
                }
                else
                {
                    Console.WriteLine("comm is not open");
                    comm.Open();

                    info.Content    = comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Manufacturer.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Model.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().Revision.ToUpper().ToString();
                    info.Content    = info.Content + Environment.NewLine + comm.IdentifyDevice().SerialNumber.ToUpper().ToString();
                    save.Visibility = Visibility.Visible;
                }
            }
            catch (Exception r)
            {
                MessageBox.Show(r.Message);
            }
        }
Ejemplo n.º 29
0
        public Boolean ModemConnect(int commPort, int commBaudRate, int commTimeOut)
        {
            Comm_Port     = commPort;
            Comm_BaudRate = commBaudRate;
            Comm_TimeOut  = commTimeOut;

            comm = new GsmCommMain(Comm_Port, Comm_BaudRate, Comm_TimeOut);

            try
            {
                comm.Open();
                if (comm.IsConnected())
                {
                    return(true);
                }
            } catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(false);
        }
Ejemplo n.º 30
0
        public static bool SendUpdate(DBObject parent, string id, string message, string number, string network, string cb)
        {
            _network = new Network(null);
            comm     = new GsmCommMain(cb, 9600, 150);
            try
            {
                SmsSubmitPdu pdu;
                byte         dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
                pdu = new SmsSubmitPdu(message, Convert.ToString(number), dcs);
                int times = 1;
                for (int i = 0; i < times; i++)
                {
                    if (comm.IsConnected())
                    {
                        Console.WriteLine("comm is already open");
                        Console.WriteLine("modem  connected:" + network + "to:" + comm);
                        _network.UpdateStatus(network, "connected");
                    }
                    else
                    {
                        comm.Open();
                        _network.UpdateStatus(network, "connected");
                    }

                    comm.SendMessage(pdu);
                    _message = new Message(parent);
                    _message.Update(id, "T");

                    sent = true;
                }
                sent = true;
            }
            catch (Exception r)
            {
                sent = false;
                _network.UpdateStatus(network, "disconnected");
                Console.WriteLine("comm is already open");
            }
            return(sent);
        }