Bidirectional TCP/IP data transfer

조회 수: 4 (최근 30일)
Baljit
Baljit 2016년 2월 17일
편집: Baljit 2016년 2월 17일
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by