B4J Question [ JServer with b4j_ws.js ] is there a built-in automatic Ping mechanism?

Waldemar Lima

Well-Known Member
Licensed User
Hello guys, between Jserver and b4j_ws.js is there an automatic Ping mechanism to avoid connection timeout or do I need to implement this too?
 

ThorstenStueker

Member
Licensed User
There should not be the need for a ping mechanism. The Connection timeout would not be avoided when using a ping mechanism. When you are writing a client and a server under normal conditions the client should do the needed requests. The Connection will not time out between. When and ih you want to get continuously informations from server you need to do the needed server requests. In one of my applications I have a B4J Server and a Java Client. The Client is requesting every second to the server to get the hardware data transferred via the Socket. The B4J Program reads out the data from GPIO Socket from Raspberry PI. To hold the measurement Data actual I need to read out in the frequency I need the data I have to read out. But there is no need for a Ping. Because the timeout mechanism works different.

When connecting the Socket for information request or sending and the other side is not answering there would be a Socket timeout. There is no difference between Ping or Socket transfer: timeout comes when there is no answer. So your Timeout Problem would anyhow come up if the Server does not answer to the Socket request.

On the other Side it is the client which requests the information from the server. So you need to think about in which frequency you will read out.
 
Upvote 0
Top