MATLAB: Do I receive a TCP/IP timeout error while receiving data using xPC Target 3.3 (R2007b)

erroroutsettingsSimulink Real-Timetcpiptimewindows

When I use xPC target to send data from the target to a host machine, I receive the following error message at the MATLAB command prompt, when the packet size is large:
ERROR: 'TCPIP timeout error while receiving data'

Best Answer

This behaviour is not due to a bug in xPC Target, 3.3 (R2007b) but is related to the default TCP/IP timeout settings on a user machine.
In order to change the default TCP/IP timeout value prior to executing a MATLAB program, execute the following script at the MATLAB command prompt:
[status, result]= system('ping -w timeout_millisec destination_host');
%Changes the default timeout to 'timeout_millisec'
if(status~=0)
disp('The timeout settings could not be changed from MATLAB, please try changing the timeout manually');
end
where timeout_millisec is the amount of time you would like to wait before the system times out and destination_host is the IP address of you xPC target machine.
The above script can also be added to the MATLAB startup options.
For more recent releases, you can use:\n
tg.set('CommunicationTimeOut',20)
If you are using the API for the .NET Framework, you can use the 'xPCTargetPC.CommunicationTimeOut' property:
Note: This link is from MATLAB R2020a documentation. Some things may not be applicable to MATLAB R2007b.