Connect EHS6T with hostname and DNS | Telit Cinterion IoT Developer Community
September 5, 2017 - 12:53pm, 5153 views
Hello,
I'm trying to connect my EHS6T to server with hostname and DNS.
Cinterion
EHS6
REVISION 03.001
A-REVISION 00.000.42
To define the dns and APN I use this command :
AT^SJNET="gprs","jcdapn1","","","8.8.8.8",0
Then I send:
m_sc = (SocketConnection) Connector.open(s);
s = socket://myadress.jcdecaux.org:91
the result is this error : Could not resolve hostname
I also tried with this function NetExtension.Hostname(m_myadress.jcdecaux.org) to get the ip with same result.
If I replace the hostname with the adress ip it's working.
I have used the same command in cinterion TC65i and it's working.
Can you tell please, how to connect with hostname with EHS6T ?
thanks.
Hello,
Generally you have 2 ways: one with AT^SJNET as you do above and the other one with parameters added to connection string in Connector.open() method (please see API for more details). Both shoud work. In most cases the network should assign the proper DNS server address so you could try to not to configure it at all. Do you always use the Google DNS 8.8.8.8 - maybe it does not have your domain.
Regards,
Bartłomiej
Hi,
Thank you for your answere.
It's a private network, we were working with IP now we want to set hostname/dns configuration. So we need a dns. it was only an example, I send:
AT^SJNET="gprs","jcdapn","","","10.232.15.75",0
Then : Connector.open("socket://myadress.jcdecaux.org:91");
I have also tried the function open with this parameter :
socket://myadress.jcdecaux.org:91;bearer_type=GPRS;access_point=jcdapn;username=;password=;dns_value=10.232.15.753;timeout=0
But it's not working.
The dns seems not be taken in account so I can't get the ip from hostname.
Hello,
I have tested with my module and it seems to be working. In my tests even if I have configured the **** DNS address the network has assigned me the proper second DNS and the connection was successfull anyway.
You can verify the DNS servers with BearerControl class and BearerControlListener like in the example below:
BearerControl.addListenerEx(new BearerControlListenerEx() {
public void stateChanged(String APN, int state, int PdpErrCause) {
try {
System.out.println("APN: " + APN);
System.out.println("BEARER state change: " + state);
System.out.println("BEARER ADDR: "
+ BearerControl.GetBearerV4Addr(APN));
System.out.println("BEARER DNS1: "
+ BearerControl.GetBearerV4Dns1(APN));
System.out.println("BEARER DNS2: "
+ BearerControl.GetBearerV4Dns2(APN));
} catch (IOException e) {
e.printStackTrace();
}
}
});
In your last post you have used "dns_value" keyword instead of "dns" - please check this.
Are you sure that your private network is properly configured and the DNS is really working properly?
Please also paste some log with exception which is thrown.
Regards,
Bartłomiej
Hi,
I have this result, but I don't know what that mean :
Connexion sur le serveur : socket://myadress.jcdecaux.org:91
APN: jcdapn
BEARER state change: 2
BEARER ADDR: 0.0.0.0
BEARER DNS1: 10.232.15.75
BEARER DNS2: 0.0.0.0
APN: jcdapn
BEARER state change: 3
BEARER ADDR: 10.143.146.154
BEARER DNS1: 1.0.0.0
BEARER DNS2: 1.0.0.0
ConnexionServeur : Could not resolve hostname
I sent this command : AT^SJNET="gprs","jcdapn","","","10.232.15.75",0.
When the bearer status pass to 2, my dns is taken in account but when the status passes to 3 it's not.
what's the problem?
Hello,
2 means connecting stae and 3 connected. There is BearerControlStates interface which contains the constants representing the bearer states.
See this example:
private String translateBearerState(int state) {
String stateString = "UNKNOWN";
if (BearerControlStates.BEARER_STATE_CLOSING == state) {
stateString = "BEARER_STATE_CLOSING";
}
if (BearerControlStates.BEARER_STATE_CONNECTING == state) {
stateString = "BEARER_STATE_CONNECTING";
}
if (BearerControlStates.BEARER_STATE_DOWN == state) {
stateString = "BEARER_STATE_DOWN";
}
if (BearerControlStates.BEARER_STATE_LIMITED_UP == state) {
stateString = "BEARER_STATE_LIMITED_UP";
}
if (BearerControlStates.BEARER_STATE_UNKNOWN == state) {
stateString = "BEARER_STATE_UNKNOWN";
}
if (BearerControlStates.BEARER_STATE_UP == state) {
stateString = "BEARER_STATE_UP";
}
return stateString;
}
Your result looks quite strange. Your defined APN is exchanged with 1.0.0.0 after the connection is established. Currently it looks like the manually defined DNS is exchanged with that assigned by the network (which should rather not happen) and additionally DNS addresses from the network are incorrect. Please try with some other network operator to compare the behavior. And please also try again with configuration of DNS in the connection string.
Regards,
Bartłomiej
Hello,
I have tried with the dns in connecting string with the same result.
I want to precise, that with the same sim, with the same dns, the hostname, the command (SJNET) it works with TC65 modem. If it's a network problem, we will have the problem also with this modem.
I tested different operators, the results :
Bouygues :
APN: jcdapn
BEARER state change: BEARER_STATE_CONNECTING
BEARER DNS1: 10.232.15.75
BEARER DNS2: 0.0.0.0
BEARER ADDR: 0.0.0.0
APN: jcdapn
BEARER state change: BEARER_STATE_UP
BEARER DNS1:10.232.15.75
BEARER DNS2: 62.201.159.99
BEARER ADDR: 10.173.139.81
ConnexionServeur : Could not resolve hostname myadress.jcdecaux.org
Sfr:
APN: m2mjcdapn
BEARER state change: BEARER_STATE_CONNECTING
BEARER DNS1: 10.232.15.75
BEARER DNS2: 0.0.0.0
BEARER ADDR: 0.0.0.0
ConnexionServeur : Profile could not be activated
APN: m2mjcdapn
BEARER state change: BEARER_STATE_DOWN
java.io.IOException: cannot resolve Addr
- com.cinterion.io.BearerControl.GetBearerV4Dns1(), bci=0
Vodafone:
APN: vodafone.jcdapn.com
BEARER state change: BEARER_STATE_CONNECTING
BEARER DNS1: 10.232.15.75
BEARER DNS2: 0.0.0.0
BEARER ADDR: 0.0.0.0
APN: vodafone.jcdapn.com
BEARER state change: BEARER_STATE_UP
BEARER DNS1: 10.232.15.75
BEARER DNS2: 10.232.15.75
BEARER ADDR: 10.151.0.13
ConnexionServeur : Could not resolve hostname myadress.jcdecaux.org
With vodafone it seems to be better, the connection succed only one time. But it's roaming connection. We use only bouygues and sfr sim.
With the dns in connection string:
Connexion sur le serveur : socket://myadress.jcdecaux.org:91;bearer_type=GPRS;access_point=jcdapn;username=;password=;dns=10.232.15.75;timeout=0
APN: jcdapn
BEARER state change: BEARER_STATE_CONNECTING
BEARER DNS1: 10.232.15.75
BEARER DNS2: 0.0.0.0
BEARER ADDR: 0.0.0.0
APN: jcdapn
BEARER state change: BEARER_STATE_UP
BEARER DNS1: 1.0.0.0
BEARER DNS2: 1.0.0.0
BEARER ADDR: 10.144.145.150
ConnexionServeur : Could not resolve hostname
I don't understand what's the problem. You have any idea ?
Thanks
Hello,
In the first test APN's were assigned properly but for some reason the host name was not resolved.
In the second test the profile was not activated - probably the APN is not correct or subscription does not include data transfer or access to this APN.
In the third test the APN addresses also seem to be assigned properly but the host name was not resolved for some reason.
In the fourth test the result is strange because the DNS addresses are not assigned properly while you tried to connect to the same APN as in the first test. Was the SIM card also the same?
Maybe this has something to do with the timing or some non-typical settings of the DNS server - you generally try to use the same APN 10.232.15.75. Maybe it would be good to experiment with some other.
On the other hand if I configure the **** DNS manually (which certainly does not respond) I still get the host name from the other assigend by the network. I have also been trying with the same firmware as you have.
Have you checked the signal quality for example with "AT^SMONI" and "AT+CSQ"?
Please also paste the AT^SCFG? output.
If it would be possible to see the TCP traces on the server side maybe that would shed some light on theis problem.
Regards,
Bartłomiej
Hello,
I have two dns address, I have tested the two with same result.
Command result :
AT^SMONI
^SMONI: 3G,10639,340,-4.0,-44,208,20,4F89,0244E63,16,71,NOCONN
AT+CSQ
+CSQ: 31,99
OK
AT^SCFG?
^SCFG: "Audio/Loop","0"
^SCFG: "Call/Ecall/AckTimeout","5000"
^SCFG: "Call/Ecall/Callback","0"
^SCFG: "Call/Ecall/CallbackTimeout","43200000"
^SCFG: "Call/Ecall/Msd","0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
^SCFG: "Call/Ecall/Pullmode","0"
^SCFG: "Call/Ecall/SessionTimeout","20000"
^SCFG: "Call/Ecall/StartTimeout","5000"
^SCFG: "Call/ECC","0"
^SCFG: "Call/Speech/Codec","0"
^SCFG: "Gpio/mode/ASC1","gpio"
^SCFG: "Gpio/mode/DAI","gpio"
^SCFG: "Gpio/mode/DCD0","gpio"
^SCFG: "Gpio/mode/DSR0","gpio"
^SCFG: "Gpio/mode/DTR0","gpio"
^SCFG: "Gpio/mode/FSR","gpio"
^SCFG: "Gpio/mode/HSIC","gpio"
^SCFG: "Gpio/mode/PULSE","gpio"
^SCFG: "Gpio/mode/PWM","gpio"
^SCFG: "Gpio/mode/RING0","gpio"
^SCFG: "Gpio/mode/SPI","gpio"
^SCFG: "Gpio/mode/SYNC","gpio"
^SCFG: "GPRS/AutoAttach","enabled"
^SCFG: "Ident/Manufacturer","Cinterion"
^SCFG: "Ident/Product","EHS6"
^SCFG: "MEopMode/Dormancy","0","0"
^SCFG: "MEopMode/SoR","off"
^SCFG: "MEShutdown/Fso","0"
^SCFG: "MEShutdown/sVsup/threshold","0","0"
^SCFG: "Radio/Band","511"
^SCFG: "Radio/OutputPowerReduction","4"
^SCFG: "Serial/Interface/Allocation","1","1"
^SCFG: "Serial/USB/DDD","0","0","0409","1E2D","0058","Cinterion Wireless Modules","EHx",""
^SCFG: "Tcp/IRT","3"
^SCFG: "Tcp/MR","10"
^SCFG: "Tcp/OT","6000"
^SCFG: "Tcp/WithURCs","on"
^SCFG: "Trace/Syslog/OTAP","0"
^SCFG: "Userware/Autostart","0"
^SCFG: "Userware/Autostart/Delay","20"
^SCFG: "Userware/DebugInterface","0.0.0.0","0.0.0.0","0"
^SCFG: "Userware/DebugMode","on"
^SCFG: "Userware/Passwd",
^SCFG: "Userware/Stdout","usb1",,,,"on"
^SCFG: "Userware/Watchdog","1"
OK
Tell me please if you something bad in the config.
I will see if I can check the server side.
Thanks
Hello,
The network signal looks good. The only thing that is incorrect here is that "Userware/Autostart" should not be disabled because thes prevents the JRC MIDlet from being started automatically. And this MIDlet is responsible for some functionalities (some AT commands). But I don't expect that this has an infuence on this problem.
How about your project - do you use the correct libraries for your module? Can you paste some code whre the connection is created and opened?
Regards,
Bartłomiej
Hello,
Previously, I was using an IP address, I was sending this command :
s_Config = "AT^SJNET=\"\",\"" + m_s_GprsPoint + "\",\"" + m_s_GprsUser + "\",\"" + m_s_GprsPass + "\"\r";
AT^SJNET="","jcdapn1","","" and it was working.
But when a see the AT command doc, it tells that the apn is accepted if bearer is gprs.
If I add dns to this command :
"AT^SJNET=\"\",\"" + m_s_GprsPoint + "\",\"" + m_s_GprsUser + "\",\"" + m_s_GprsPass + "\",\"" + m_s_Dns +"\",0\r";
AT^SJNET="","jcdapn1","","","10.232.15.75",0, I have an error
So I send this command AT^SJNET="gprs","jcdapn1","","","10.232.15.75",0 and it's working.
If I want to use the modem in 3G/4G is it a problem if a set the bearer to gprs ?
I have sended my code in private message.
Thanks
Pages