ServerSocket accept failed (-134) on EHS5 | Telit Cinterion IoT Developer Community
November 14, 2023 - 12:07pm, 47 views
Hello
the following call sometime throws an IOException:
private ServerSocketConnection m_serverSocket = null;
...
SocketConnection sc = (SocketConnection)m_serverSocket.acceptAndOpen();
the exception getMessage() text is the following:
IOError in serversocket::accept = -134
Why is it happening ? Is there any explanation for the error code -134 ?
Where I can find a list of the possible socket error codes for these api ?
Best regards
Marco
Hello,
There is unfortunately no such list published in the documentation.
-134 code meaning is 'Network is down'.
That could mean that the module is not registered to the network. It could be the case due to the poor coverage or maybe the ServerSocketConnection is started just after the module boots and MIDlet starts without checking if the module already attached to the network.
It would be a good practice to verify the cellular network registration before starting any network connections in the MIDlet.
Best regards,
Bartłomiej
Hello Bartlomiej,
thank you for your answer.
The problem does not occurs just after the module boot, but it may occur several ours (or days) after in a random manner.
Also, when it occurs, it seems not to be recoverable: the normal procedure in the case of this error closes the socket, creates a new one, and restart a new socket; but, after these operations, the serversocket is not reachable again. From the network perspective, the module does not respond to any paccket sent to it.
What do you think could be the correct procedure to recovery these kind of errors ?
Note that if the module is restarted, the network works correctly again.
Best regards
Marco
As, based on the error code, it seems to be network related, I would start from adding the network registration and signal quality to the app.
You can do this with AT commands and the relevant API. At least you could register and catch URC's: AT+CREG=2, AT+CGREG=2. Additionally AT+CGEREP=2,1. You can periodically send AT^SMONI to log the network quality parameters. If you really detect network detach you can send AT+CEER to get error information if available.
With this done you should be able to confirm or exclude if there is really a network issue. And if it is, you could react on that. As you noticed that after reboot it works again, in the worst case you can trigger the reboot. Before that you could try deregistering from the network or switching to airplane mode for a while.
Hello Bartlomiej,
thank you very much for your suggestions!
Best regards
Marco