Http Post problem | Telit Cinterion IoT Developer Community
November 26, 2018 - 2:20pm, 3093 views
Dear,
I am using 3 modem types: TC65i, EHS8 and the ELS61. On all three I use the code below to check the internet connection. On the TC65i and the ELS61 it works fine.
When I put a (Dutch) T-Mobile card into the EHS8 the function freezes. It also freezes the running Timer class.
I'm doing the exact same thing with the TC65i and ELS61 and all works OK. I also tried multiple sim cards from T-Mobile but with the same result.
What is going wrong when using the EHS8?
Regards.
The revision of the EHS8:
Cinterion EHS8 REVISION 03.001 A-REVISION 00.000.51
Code:
public static boolean ping(String url) { HttpConnection c = null; OutputStream os = null; InputStream is = null; int ch; StringBuffer b = new StringBuffer(); try { c = (HttpConnection)Connector.open(url); // Set the request method and headers c.setRequestMethod(HttpConnection.POST); c.setRequestProperty("If-Modified-Since","7 Sep 2005 19:43:31 GMT"); c.setRequestProperty("User-Agent","Profile/MIDP-1.0 Configuration/CLDC-1.0"); c.setRequestProperty("Content-Language", "en-US"); // Getting the output stream may flush the headers os = c.openOutputStream(); os.write("Ping".getBytes()); os.flush(); is = c.openInputStream(); while ((ch = is.read()) != -1) { b.append((char)ch); } isPing = true; } catch(Exception e) { isPing = false; System.out.println("Ping failed\r"); } finally { try { os.flush(); os.close(); } catch (Exception ex) { } try { is.close(); } catch (Exception ex) { } try { c.close(); } catch (Exception ex) { } System.out.println("Pinging return: " + isPing + "\r"); return isPing; } }
Hello,
Can you write when exactly the program freezes? As I understand your Timer class is running as a separate thread and it also freezes.
Is it only happening for T-Mobile SIM, have you tried with other providers? Are these SIMs working with other devices?
Have you tried to open any internet service with AT commands - is it working?
Best regards,
Bartłomiej
Bartłomiej,
It freezes on "os.flush()". When I commend this it freezes on "is = c.openInputStream()". This didn't make sense to me as I would xpect it would freeze in the while loop.
I run a Timer class as a thread and call this function also as a seperate thread.
I have tried all possible providers. The only one I have this issue with is T-Mobile in combination with the EHS8. All other combinations (modems and providers) work OK so far. I have also tried a T-Mobile prepaid and subscription, both with the same result. Furthermore I tried to change the URL I try to ping, tried http and https URLs. Tried it without the ping (only a post). No positive results either.
I managed to open the internet service and f.i. send a mail. I'm using this function though to check the internet connection. Strange thing here is that it does work on the other modems with the same sim card.
regards.
Hello,
So this problem happens only for a specific operator. So the cause may be somewhere between SIM card and the module. I think that you should first update the module to the latest available firmware version - currently it is A-REVISION 00.000.55. I can provide it to you. You may check if the module is registered to the network before the connection attempt is made. You might add com.cinterion.io.BearerControlListener to see the bearer states before this happens.
If that will not help I think that, as it seems to be some very specific and operator dependent case, tracing is needed on the module side with your device and SIM card to find more information about the possible root cause. So I think that you should then contact your local Gemalto office or distributor to report this.
Regards,
Bartłomiej
Bartłomiej,
Can you provide me the A-REVISION 00.000.55? I wil test it.
I have sent you an email.
Regards,
Bartłomiej
Bartłomiej,
I've tried ARN14, 51 and 55. They all behave the same way.
regards
So if this didn't help I think that you need to contact your local Gemalto office or distributor and report it. This seems to be operator specific and on-site testing and tracing will be needed.
Regards,
Bartłomiej