Why do I get the error "Timeout occurred while waiting for the String Terminator"?
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 27 de Nov. de 2020
Respondida: MathWorks Support Team
el 27 de Nov. de 2020
I am trying to create a TCP/IP client connection with a TCP/IP server using tcpclient() (formerly tcpip()). But I get the following error:
>> echotcpip("on",5000);
>> t = tcpclient("10.10.10.100",5000);
>> val = writeread(t,"ctrlcmd");
Error reading String.
Timeout occurred while waiting for the String Terminator.
Respuesta aceptada
MathWorks Support Team
el 27 de Nov. de 2020
What you see in the error message is the TCP/IP client saying that it expected a reply, but it did not receive a reply within the timeout period, or it did not receive the reply that it expected.
This can happen if the terminator is not configured correctly. In most cases, the TCP/IP server you are talking to will only recognize that it received a command if you end that command with terminator, such as "CR/LF".
To work around the issue, find out the correct terminator for your TCP/IP server, and specify it using the configureTerminator method:
>> t = tcpclient("10.10.10.100",5000)
>> configureTerminator(t,"CR/LF")
>> val = writeread(t,"ctrlcmd")
For the obsolete tcpip() command, the equivalent would be:
>> t = tcpip("10.10.10.100",5000)
>> t.Terminator = "CR/LF";
>> data = query(t,"ctrlcmd")
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!