我正在使用SMSlib将短信发送到手机号码。但是出现了以下错误。我甚至改变了加密狗,但没有成功。
org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
以下是我的代码 -
public static void sendMessage(String number, String message) {
Service srv = Service.getInstance();
try {
srv.addGateway(new SerialModemGateway("modem.com1", "COM5", 9600,
"huawei", "E220"));
} catch (GatewayException e1) {
e1.printStackTrace();
}
try {
srv.startService();
OutboundMessage msg = new OutboundMessage(number, message);
srv.sendMessage(msg);
srv.stopService();
} catch (Exception e) {
e.printStackTrace();
}
}
对于调试跟踪,您可以找到它here
答案 0 :(得分:1)
我使用的港口是错误的。我们必须首先使用SMSLib提供的CommTest
实用程序扫描端口。我使用了不同的库来实际发送机器。