2

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.

CN1002
  • 1,115
  • 3
  • 20
  • 40

1 Answers1

1

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. enter image description here

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:

enter image description here

Jure
  • 799
  • 6
  • 25
  • thanks for response, my laptop does not have that. It is not showing - when I read on google, I saw a port which said some laptops do not have those. – CN1002 Feb 11 '16 at 13:38
  • @Giovanrich What operating system do you use? If you use windows you should have ports. – Jure Feb 11 '16 at 13:39
  • I am using Windows 7 Ultimate -64bits – CN1002 Feb 11 '16 at 13:40
  • @Giovanrich I have added aditional information to my answer under the image. – Jure Feb 11 '16 at 13:43
  • Okay, i am using a Sony Xperia Model LT26i – CN1002 Feb 11 '16 at 13:45
  • @Giovanrich Try to install USB drivers for you phone, and see if it wil be listed under Ports. – Jure Feb 11 '16 at 13:53
  • Okay, let me try that but already I can send media between my phone and my pc - does that happen when there is no driver for the phone? – CN1002 Feb 11 '16 at 13:56
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/103201/discussion-between-jure-and-giovanrich). – Jure Feb 11 '16 at 14:00