1

I am working on Java EE application where I want to send/receive messages to and from mobile number.

For this purpose I have used GSM Modem/Dongle.In which I have inserted SIM card from which I will transfer my messages to and from other mobiles.

So, to establish connection with GSM Modem I have to find USB port number where my GSM modem is connected.

So my question is how to find port number where my GSM modem is connected.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Aniket
  • 2,204
  • 5
  • 34
  • 51
  • I think you'll need to get all connected usb devices and then find device you're interested in (GSM modem in given question). Since there're not thousands of usb hubs this won't be too heavy work. _Note:_ May be I am wrong and there's a way to get device directly. – Leri Feb 22 '13 at 07:12
  • @PLB you know how to find all connected usb devices? – Aniket Feb 22 '13 at 07:20
  • You could use [`jUSB`](http://jusb.sourceforge.net/). But I've never used it. – Leri Feb 22 '13 at 07:22
  • i have tried much since you told me to use "jUSB" but i cant found port number, even i didn't got any solution to detect USB port using "jUSB".I have also searched on "JSR" ...so you know any other way.. – Aniket Feb 22 '13 at 13:56
  • @Aniket have you tried this one: http://jcp.org/en/jsr/detail?id=80 – user1725145 Feb 23 '13 at 21:37
  • @Aniket, sorry for late reply dear, well for Comm port you have to manually check Port number from Device Manager and select "Modem" init. – Lucifer Mar 15 '13 at 15:14
  • @Aniket, have you tried, what i said ? – Lucifer Mar 18 '13 at 11:36
  • @Lucifer i have checked it shows com 3 or com 6... – Aniket Mar 18 '13 at 12:50
  • @Aniket, no, if you click on modem and then view its properties, it shows you only that modem's comm port, and you need to define that port into your code. – Lucifer Mar 18 '13 at 14:18
  • @Lucifer i have checked it shows me com4 but if i used com4 it can't print "SMS Sending....Port Found" as in case if i used com3 port number.. – Aniket Mar 18 '13 at 14:43
  • @Aniket, strange....it shouldn't show that. – Lucifer Mar 19 '13 at 04:56
  • @Lucifer is it possible to you to come down for chatting so i can better explain my work what actually i have done and where i am going wrong.... – Aniket Mar 19 '13 at 05:54
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/26428/discussion-between-lucifer-and-aniket) – Lucifer Mar 19 '13 at 06:34

1 Answers1

1

Use ModemManager :

mmcli -L # list modems
mmcli -m <modem> # show modem

If you want to get the ports see here.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
marquicus
  • 180
  • 2
  • 5