TCP/IP send and receive block (Instrument control tool) not working between two computer.

8 views (last 30 days)
Can anybody help how to do TCP/IP communication between two computer with simulink. TCP/IP send and receive block is working fine in one computer, but I cannot make it in two computer. Error says "the specified amount of data was not returned within the timeout period. Please ensure the data is being sent to the specified port or specify a greater timeout value" Note that, firewall is deactivated and TCP/IP connection established.

Answers (1)

devinda Molligoda
devinda Molligoda on 2 Jul 2015
Hi, I too have the same problem. The echo example works fine provided by Matlab. But when I go to 2 pcs its giving the same error. This is the code I tried.(Matlab version 2014b) If someone has a solution please share. Thanks.
%TCP Client running in PC#1----------------------------------------------------
tt = tcpip('155.69.213.95'); % Connect the TCPIP object to the host.
fopen(tt)
for i = 1:1000
fwrite(tt,65:74)
pause(0.2);
end
fclose(tt)
%TCP Server running in PC#2---------------------------------------------------
t = tcpip('155.69.213.135');
fopen(t)
i = 0;
for i = 1:1000
A = fread(t, 10);
pause(0.2); A end
fclose(t)

Tags

Community Treasure Hunt

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

Start Hunting!