January 19, 2017 - 12:14pm, 9062 views
How to check state of a SocketConnection with Java API?
After a SocketConnection opened, if other party closes the socket or if it drops due to network conditions how to be aware of that? Is there a notification to catch?
Hello Mr. Micheal,
Thanks for the update. I am still not achieving the desired results as your colleague has mentioned. Please find attached the code which I have tested and the desired results are not achieved.
Here is the code : code.txt
I have used your code and I was able to reproduce this. Most likely this is due to the reason which Łukasz already descired. Could you explain how this influence your application?
Hello Mr. Michal,
It won't influence my application that much, but I was thinking may be Connector.open() plays some role here because it happens only when this function is called. But thanks I am clear now why this is happening now.
I have some questions:
1) I have some confusion regarding AT+CREG? returns +CREG :0,0 ( it means not registered to network ). What can be the possible cause of this ( one could be sim card not inserted) ?
2) I have certain scenario : I am in the forest and using the modem to send my positions ( lat, long ) to the server and suddenly loses coverage of the network. At that point in time, calling AT+CREG? ( would it return 0,0 not registered ).
3) Is AT+0CREG? directly related to coverage of the network ? For example if there is no coverage AT+CREG? would always return +CREG:0,0 and when it gets back coverage it will return +CREG:0,1. At the moment just leave 0,2 which means searching for a new operator.
1) - no SIM - no network coverate (it will usually switch between 0 & 2 in intervals dependent on the radio environment - how many network signals available etc.)- module set with AT+cops=2- Airplane ****
2) it will switch between 0 & 2 like described in #1
3) like described in #1
Thanks for your response and explanation. Regarding AT+CREG? returns +CREG :0,3 ( Registration Denied) I have following observations and questions.
- I used a sim card, which has reached its data limit and I got registration denied ( observation and obvious reason ).
- Scenario : I am in region A, where operator A ( telekom ) is only available, but I am using a sim card from operator B ( vodafone ) . Would I get registeration denied or switch between 0, 2 ?
-I am not sure in the above scenario whether the modem using vodafone will try to register to telekom network or not.What would be the outcome in your view ?
Each operator will have a list of allowed network. If the module is in the range of a foraign network it will check if the network is on his prefered network list and ask for registration, after that the foraign network will ask your operator if it's allow to connect him (and charge). If yes - you will be registered in roaming (creg : 0,5). I not - module will skan for another network (creg: 0,2)
creg: 0,3 you will get when module will receive the information from it's home network that it will not be connected (e.g. subscription not active).
© 2013-2014 Gemalto M2M GmbH