gsmcommunication.com发生了Gsmcomm.gsmcommunication.commexception [英] Gsmcomm.gsmcommunication.commexception' occurred in gsmcommunication.dll

查看:111
本文介绍了gsmcommunication.com发生了Gsmcomm.gsmcommunication.commexception的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm using ASP.net to send SMS to mobile using GSM Device but unable to send message and getting this error GsmComm.GsmCommunication.CommException in GSMCommunication.dll

Please suggest me how do i resolve this error. I have below code :





我尝试过:





What I have tried:

using System;  
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Linq;
 using System.Text;
 using System.Windows.Forms;
 using System.Data.SqlClient;
 using System.Text.RegularExpressions;

  using System.Runtime.Remoting.Channels;
  using System.Runtime.Remoting.Channels.Tcp;
  using GsmComm.PduConverter;
  using GsmComm.PduConverter.SmartMessaging;
  using GsmComm.GsmCommunication;
  using GsmComm.Interfaces;
  using GsmComm.Server;
  using System.Globalization;

  namespace GSMModem
{
      public partial class Form1 : Form
{
      private GsmCommMain comm;
      private delegate void SetTextCallback(string text);
      private SmsServer smsServer;
      public Form1()
    {
        InitializeComponent();
      }
    TextBox txtMessage = new TextBox();
    TextBox txtDonorName = new TextBox();
    TextBox txtNumber = new TextBox();
    TextBox txtDonorId = new TextBox();
    private void btnExit_Click(object sender, EventArgs e)
    {
        Close();
      }
    private void btnSend_Click(object sender, EventArgs e)
    {
        SmsSubmitPdu pdu;
                    byte dcs = (byte)DataCodingScheme.GeneralCoding.Alpha7BitDefault;
                    pdu = new SmsSubmitPdu("TESTING MESSAGE", "03325483575", dcs);
        comm.SendMessage(pdu);
 }

    private void Form1_Load(object sender, EventArgs e)
    {
        cmbCOM.Items.Add("COM1");
        cmbCOM.Items.Add("COM2");
        cmbCOM.Items.Add("COM3");
        cmbCOM.Items.Add("COM4");
        cmbCOM.Items.Add("COM5");
        cmbCOM.Items.Add("COM6");
        cmbCOM.Items.Add("COM7");
    }

    private void btnConnect_Click(object sender, EventArgs e)
    {
        if (cmbCOM.Text == "")
        {
            MessageBox.Show("Invalid Port Name");
            return;
        }
         comm = new GsmCommMain(cmbCOM.Text , 9600, 150);
        Cursor.Current = Cursors.Default;
        bool retry;
        do
        {   retry = false;
            try
            {   Cursor.Current = Cursors.WaitCursor;
                comm.Open();
                Cursor.Current = Cursors.Default;
                MessageBox.Show("Modem Connected Sucessfully");
            }
            catch (Exception)
            {   Cursor.Current = Cursors.Default;
                if (MessageBox.Show(this, "GSM Modem is not available", "Check",
                    MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Retry)
                    retry = true;
                else
               { return;}
           }
        }
        while (retry);

    }

    }
      }

推荐答案

我们可以'告诉 - 我们无法在相同的情况下运行您的代码,因此我们可以;必然会复制错误。



所以,它会上升对你来说。

在方法的第一行放置断点,然后通过调试器运行代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步执行每一行检查您预期发生的情况正是如此。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。


对不起,但我们不能为你做到这一点 - 时间让你学习一门新的(非常非常有用的)技能:调试!
We can't tell - we can't run your code under the same circumstances you can, so we can;t necessarily duplicate the error.

So, its going to be up to you.
Put a breakpoint on the first line in the method, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

Sorry, but we can't do that for you - time for you to learn a new (and very, very useful) skill: debugging!


这篇关于gsmcommunication.com发生了Gsmcomm.gsmcommunication.commexception的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆