how to send data through Echo TCPIP Server in MATLAB
Afficher commentaires plus anciens
hi,my name is Deepu, i want to send stream of data through Echo TCPIP Server, is it possible?How?
NOTE: i'm using 2018a verson MATLAB
Thankyou.........
Réponses (1)
yanqi liu
le 5 Jan 2022
0 votes
yes,sir,may be view
if use http get、post,may be view
10 commentaires
Deepu S S
le 5 Jan 2022
Deepu S S
le 5 Jan 2022
yes,sir
ts = tcpserver("127.0.0.1",4000)
tc = tcpclient("127.0.0.1",4000)
yanqi liu
le 6 Jan 2022
yes,sir,may be check
run in one MATLAB env
% server
close all;clear all;clc;
t_server=tcpip('0.0.0.0',4000,'NetworkRole','server');
fopen(t_server);
try_times=100;
for i=1:try_times
pause(0.02);
try
data_recv=fread(t_server,t_server.BytesAvailable);
fprintf('\n%s\n',char(data_recv));
catch
t_server.ValuesReceived;
end
end
run in another MATLAB env
% client
close all;clear all;clc;
t_client=tcpip('localhost',4000,'NetworkRole','client');
fopen(t_client);
% data_send=sin(1:64);
txt_send='HELLO, Deepu S S';
pause(1);
% fwrite(t_client,data_send);
fprintf(t_client,txt_send);
we run the first、the second,and then,the first MATLAB env can get

this is string,may be add some encode、decode method,use it as communication demo
Deepu S S
le 6 Jan 2022
yanqi liu
le 6 Jan 2022
yes,sir,what is the file type?is it “.txt” or anything?
Deepu S S
le 10 Jan 2022
yanqi liu
le 10 Jan 2022
yes,sir,may be use base64 encode to string and decode to file
Deepu S S
le 11 Jan 2022
Catégories
En savoir plus sur TCP/IP Communication dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!