How to solve "Unsuccessful read: tcpip Timeout"

9 views (last 30 days)
MD
MD on 7 Mar 2019
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!

Answers (1)

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

Categories

Find more on Data Acquisition Toolbox Supported Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!