Bidirectional TCP/IP data transfer

4 visualizzazioni (ultimi 30 giorni)
Baljit
Baljit il 17 Feb 2016
Modificato: Baljit il 17 Feb 2016
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

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by