In communication protocols, a certain sender and receiver cannot wait for a lifetime if data is not being communicated. This results in lag of communication and breaks the network, because the bandwidth is not utilized. For this, to continue with the other network work even if one communication fails, a setting called timeout is used in these protocols.
An incorrect setting of this parameter can result in improper operation of communication. In this post, we will see why a timeout plays an important role in communication protocols.
What is timeout?
Let us understand a basic concept first. In any communication, there are two parties – transmitter and receiver. A transmitter will send a message and the receiver will receive it. In return, the receiver will send an acknowledgment to the transmitter that it has received the message. The transmitter waits for this acknowledgement and it understands that the message has been communicated properly. For this purpose, there is a waiting time for getting this acknowledgment.
In this time interval, the acknowledgment should reach the transmitter. After the time elapses, if still the acknowledgment is not received, then it means the communication has not happened. This causes the transmitter to throw an exception message in the whole network, alarming about the failure in communication. This waiting time is called a timeout in communication protocols.
Typical values of timeout are in milliseconds or seconds. Most of the controllers have a default value for this timeout. It is set according to the function of the product. If required, then you can change the value of this timeout according to your applications.
What happens when the timeout is too fast or too slow?
Timeout is first of all important to set. Because every request by a transmitter will not be responded to by the receiver. So, a waiting time must be given for this response to be received in the transmitter. When the request has been sent, the timeout timer starts. In between, if the response has been received, then the timer resets to zero and starts again on the next request.
If the timeout is set too slow or long, then it will result in communication lag of the network. Because, if there are many devices in the network with a single master and multiple slaves, then the next slave will have to wait to give its response till the response of the first slave is over and acknowledged. Due to this, the network becomes slow and all the resources will not be utilized efficiently. Also, if other devices are added in the future, then a lot of network traffic will increase leading to increased congestion.
If the timeout is set too fast or short, then it will cause data loss or an unreliable network. This is because the slave devices will not get much time to respond to a request. If the ideal time for communication is 5 seconds, and you have set the time to 3 seconds, then communication errors will arrive every time; because you have not given ample time for the network to settle.
So, it is necessary to ensure that timeout is set properly so that the data packets are not lost. It is not necessary that data packets will reach at the same time every interval. So, a proper in-between value ensures a buffer in case some lag happens in the network. It must not be too fast nor too slow.
Factors
Timeout is also dependent on various factors like:
- Total number of devices in a network
- Data length
- Distance between each device
- Electrical noise around
- In a PLC or HMI program, apart from communication, there are other actions too like periodic functions or time-based functions which recur in a fixed interval every time. This time, along with communication time, adds to overall processing speed. So, depending upon your program written for these actions, timeout must be set accordingly. Otherwise, it can cause a lag in processing speed and indirectly, a delay in communication.
In this way, we saw the role of timeout in communication protocols.
Read Next:
- What is IEC 61508?
- Modbus versus DNP3 Protocols
- OSI Layers of Communication
- Networking Interview Questions
- Basics of SCADA Hardware