problem with connection | Thales IoT Developer Community
July 15, 2019 - 9:13pm, 9741 views
Hello good afternoon.
I am trying to establish a Https GET connection, with a midlet in java.
I get an exception in httpConn.getResponseCode ();
What I want is to know if I have to configure something with the at commands.
AT ^ SICS = 0, "conType", "gprs0"
at ^ siss = 0, srvType, http
?
and I want to know if there is any way to know that I have an internet connection, and that the apn I enter is valid.
I was putting the dns wrong. It already works with public servers, but with the server that I should use it does not work.
I restart the module every time I want to try, I do not know if there is a way to try again without restarting. but good now it works.
but with my server I get this:
^SIS: 1,0,210,"INT:;IOError -149 during socket:: write \0a"
I tested without security (http) and redirects to https:
at^siso=1
OK
^SIS: 1,0,2200,"Http *********:80"
^SIS: 1,0,2200,"redirect to: https://*********xxxxxx"
^SIS: 1,0,210,"INT:;IOError -149 during socket:: write \0a"
in java the same. it works with the 2 public servers, but when using mine it gives me this error: java.io.IOException: error in sendRequest -313 SSL-Error: revcd alert fatal error
that is to say, the error only comes out when accessing my server, but there is no authentication whatsoever, so I do not understand what the cause might be.
-------------------------------------------------------------------------
In Java, if I can connect, as follows:
String url = "https://**********************";
URL obj = new URL(url);
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
con.setRequestProperty("User-Agent", USER_AGENT);
int responseCode = con.getResponseCode();
System.out.println("Response Code : " + responseCode);
If I delete this line(con.setRequestProperty("User-Agent", USER_AGENT);), it no longer connects. (I say in case it gives some idea of why it is not connected in the midlet or the at commands)
--------------------------------------------------------------------------
in j2me of the midlet I can not connect, the code is as follows:
HttpConnection httpConn = null;
httpConn = (HttpConnection)Connector.open(url+";bearer_type=gprs; access_point=m2m.movistar.es;");
httpConn.setRequestProperty("User-Agent", USER_AGENT);
int responseCode = httpConn.getResponseCode();
---------------------------------------------------------------------------------
I mention the line:
con.setRequestProperty("User-Agent", USER_AGENT);
because when I delete it, the other 2 servers continue to work the same, but mine does not work. maybe it has something to do with it, because without that line it behaves just like with the at commands.
Hello,
Thanks for additional information. Some TLS servers require SNI feature which is not supported directly by this module. However, you can implement it using external library, Please check below showcase from the forum:
https://iot-developer.thalesgroup.com/showcase/java-https-sni-bouncycastle
I don't know URL of your sever, so I cannot be sure that lack of SNI is the root cause but I think it is worth to check it.
Best regards,
Adam
Hello Adam.
I have tried to test the connection with what you have sent me and I have not been able to connect with those programs. Is it possible to send you the http server that I use by private message so you can see it in more detail?
Hello,
Can you write more about the test with the application Adam adviced you? What was the result? Do you have any log?
As for this error - 313 SSL-Error: revcd alert fatal error - it most probably means that the server sent Alet message to the module just after receiving ClientHello message and closed the connection. Do you have a possibility to trace on your server? It might mean that there was something missing in ClientHello what server is configured to require - for example it might be cipher suite or extension or SNI. In case server serves multiple domains on the same IP and there are different certificates for different domains it uses SNI information received in ClientHello to send the proper certificate to the client. It might be configured to require SNI information and close the connection if it's not provided in ClientHello. Or if the server does not require a host to use SNI it may send the wrong certificate to the host as during TLS handshake it does not yet know what domain the host wants to visit. But in this case we wouldn't see this error probably.
Best regards,
Bartłomiej
Hi Bartolome.
Thank you for the response, I have spoken to the server managers, I am waiting for your response, when I know something I will let you know, thank you very much
Hi Bartłomiej, it was a type of security they had on the server that denied us access, they have modified security and now we have access. Thank you very much for your help.
You're welcome.
It would be great if you could write something more about that security configuration on server. Maybe it's something typical and could help others in the future.
Regards,
Bartłomiej
I have been told that they now return the server's ip that had it hidden. it is all that I know
good afternoon
HTTPS server designers tell me they will modify the authentication, and ask me if they can use "oauth2 and JWT". I wanted to know if the module is compatible with this, I guess so, but I wanted to ask to confirm. Thank you.