Gemalto is now part of the Thales Group, find out more.

You are here

Unexpected reboot problem solved - Voodoo required for Connector.open() | Thales IoT Developer Community

January 9, 2017 - 10:53am, 2557 views

Hello!

Just for reference: I struggled over 1,5 years with unexpected reboots of a EHS5T module. The voodoo-esque workaround is:

Before closing resources, wich were opened in Java ME with Connector.open(), e.g.

  • HTTP Request:          httpc = (HttpConnection) Connector.open("http://...");
  • HTTPS Request:      httpsc = (HttpsConnection) Connector.open("https://...");
  • Socket Request:        sc = (SocketConnection) Connector.open("socket://...");
  • Socket Server:           ssc = (ServerSocketConnection) Connector.open("socket://:<port>..."); 
  • File:                          fconn = (FileConnection) Connector.open("file:///...");
  • COM-Port:                 comm = (CommConnection) Connector.open("comm://...");

one has to wait 100ms.

Java-Pseudocode:

xxxConnection conn;
InputStream is;
OutputStream os;
try {
    conn = (xxxConnection) Connector.open(...);
   is = conn.openInputStream(); // Optional
   os = conn.openOutputStream(); // Optional
   ...   
}
catch (...) {
    ...
}
finally {
    Thread.sleep(100); // sleep and each of all 3 close() commands in real code with try/catch 
   is.close();  // Optional
   os.close();  // Optional
   conn.close();
}