Network idle timeout Exception in ServerSocket | Telit Cinterion IoT Developer Community
February 4, 2016 - 9:28pm, 2670 views
Hi all,
I am using a server socket in my java program and i have a issue.
I open the server connection:
ServerSocketConnection ssc = (ServerSocketConnection) Connector.open("socket://:1234;bearer_type=gprs;access_point=" + prg.getGprsAPN() + ";dns=8.8.8.8;username=" + prg.getGprsUser() + ";password=" + prg.getGprsPassword());
Also I tried with the parameter ;timeout=20; I dont sure about the unit, ms or s, so I tried with many differentes values.
IOException idle timeout is thrown after two minutes waitting in acceptAndOpen method.
SocketConnection sc = (SocketConnection) ssc.acceptAndOpen();
I recieve connections before this time, this is ok, but if there is not connections in these minutes the exception is thrown and i have to close and open the serverconnecion and wait again in acceptAndOpen method.
why idle time out exception is thrown?
Best Regards
Hello,
The timeout parameter that you can add to connection string is the same that may be configured by AT^SJNET command (you can use SJNET or add the parameters to connect method in order to configure the connection for Java). So you can read more about this in the AT commands specification.
It specifies the number of seconds to wait before the network connection is terminated automatically when it's idle. You can set 0 to have no timeout. But please note that even with 0 setting the network can also disconnect your device after some idle time specific for the network provider.
Best regards,
Bartłomiej