Bidirectional TCP/IP data transfer
显示 更早的评论
I am trying to transfer data from Matlab running on a PC and wiznet wiz550io module. I am only able to send data one way from Matlab to wiz550io. Could someone please help me with the transfer of data from wiz550io to Matlab? Here is my code
if true
try
%Create a client interface and open it.
t = tcpip('163.1.6.228', 8080, 'NetworkRole', 'client');
fopen(t);
% Write the waveform to the server session.
fwrite(t, 'GET10.55')
disp('1 Success!');
fclose(t);
catch
disp('1 Failed!');
fclose(t);
end
end
if true
try
%Create a server interface and open it.
t = tcpip('163.1.6.228', 8080, 'NetworkRole', 'server');
fopen(t);
data = fread(t, t.BytesAvailable)
disp('2 Success!');
fclose(t);
catch
disp('2 Failed!');
fclose(t);
end
end
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 TCP/IP Interface 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!