How to solve "Unsuccessful read: tcpip Timeout"

9 次查看(过去 30 天)
Hello, everybody,
I have a Matlab (R2018a) error or a warning I'm desperate for right now. I want to send a message (or command) via TCP/IP to a server and then read the answer again. I do this as follows:
write1= '<Commandxyz/>';
write2 = '<Command123/>';
t = tcpip('172.31.1.1xx', 61xx);
pause(2)
fopen(t);
pause(2)
fprintf(t, write1);
pause(2)
read1=fscanf(t, '%s')
fprintf(t, write2);
pause(2)
read2=fscanf(t, '%s')
pause(2)
fclose(t);
delete(t);
clear t
Sometimes the transfer works but in most cases I get the following warning and an empty array back:
Warning: Unsuccessful read: A timeout occurred before the Terminator was reached.
'tcpip' unable to read all requested data. For more information on possible reasons, see TCPIP Read Warnings.
Does anyone have any idea how I can get this problem solved? I have tried to insert pauses everywhere but that didn't help either.
Thank you very much!

回答(1 个)

Pruthvi Muppavarapu
The following link addresses the possible causes of error and a way to resolve them:
Hope this answers your query.

类别

Help CenterFile Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by