Jamaa SMPP客户端工作示例

时间:2012-10-03 11:46:14

标签: c# smpp

我正在使用Jamaa SMPP客户端

有没有人有发送短信的工作示例?

这是我的代码:

var textMessage = new TextMessage() { DestinationAddress = "XXXXXXXXX", SourceAddress = "XXXXXXXXX", Text = "test" };
var client = new SmppClient();
client.Properties.SystemID = "xxxx";
client.Properties.Password = "YYYY";
client.Properties.Port = ZZZZ;
client.Properties.Host = "255.255.255.255";
client.Properties.DefaultEncoding = DataCoding.SMSCDefault;
client.Properties.AddressNpi = NumberingPlanIndicator.Unknown;
client.Properties.AddressTon = TypeOfNumber.Unknown;

client.ForceConnect();
client.Start();
client.SendMessage(textMessage);
client.Shutdown();

但是我的提供商说我缺少绑定信息(Bind_transceiverBind_transmitterBind_receiver

1 个答案:

答案 0 :(得分:0)

看看下面的示例代码。我想你缺少SystemType参数。发送操作对我很好。

// Initialize Connection 
        client = new SmppClient();
        properties = client.Properties;
        properties.SystemID = "BBBB";
        properties.Password = "BBBB";
        properties.Port = 1234; //IP port to use
        properties.Host = "1.2.3.4"; //SMSC host name or IP Address
        properties.SystemType = "EXT_SME"; 
        properties.DefaultServiceType = "EXT_SME";
        //Resume a lost connection after 30 seconds
        client.AutoReconnectDelay = 3000;

        TextMessage send_msg = new TextMessage();

        send_msg.DestinationAddress = mobile_number; //Receipient number
        send_msg.SourceAddress = "1234"; //Originating number
        send_msg.Text = message;
        send_msg.RegisterDeliveryNotification = true; /
        client.SendMessage(send_msg);
        general_obj.WriteLog(mobile_number +" "+message, "SendLog");