I want to send am SMS to my mobile phone that I have connected to my PC through a USB port. I am using SMSLib for this purpose. I am trying to run this code example but I am getting the following error.
The output of the program including the error message:
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org Version: 3.5.4
[main] INFO smslib - SMSLib: A Java API library for sending and receiving SMS via a GSM modem or other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
[main] INFO smslib - Version: 3.5.4
[main] INFO smslib - JRE Version: 1.8.0_45
[main] INFO smslib - JRE Impl Version: 25.45-b02
[main] INFO smslib - O/S: Windows 7 / amd64 / 6.1
[main] INFO smslib - Queue directory not defined. Queued messages will not be saved to filesystem.
[Thread-3] INFO smslib - GTW: modem.com1: Starting gateway, using Generic AT Handler.
[Thread-3] INFO smslib - GTW: modem.com1: Opening: COM4 @115200
[Thread-3] INFO smslib - GTW: modem.com1: Closing: COM4 @115200
[main] INFO smslib - GTW: modem.com1: Stopping gateway...
[main] INFO smslib - GTW: modem.com1: Closing: COM4 @115200
[main] INFO smslib - GTW: modem.com1: Gateway stopped.
org.smslib.GatewayException: Comm libraryexception:java.lang.RuntimeException: javax.comm.NoSuchPortException
at org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
I have simply connected my phone to my PC using a USB cable. Also, I think from the error, the COM4 cannot be found. When I searched for for this I found out that my laptop does not have COM Ports. I have tried BIOS settings but there is no place to enable COM ports and I cannot see them in Device Manager.
How can I solve this problem? What must I replace with COM4?Thanks.
Go to your device manager and check if you see your phone under Ports. If he is listed there, check which COM is using, COM is writen in the brackets besides the device. You need to use the same COM in your application. Bellow is the image of my device manager so that you can see how should it look.
But normally devices that can be seen under Ports use serial communication (RS232). Your phone probably doesn't use serial communication or you need to install drivers. This is how you should see your phone: