Why we are using jtcp function in MATLAB?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Deepu S S
le 16 Déc 2021
Commenté : Walter Roberson
le 27 Déc 2021
"Hi guys i'm Deepu.please refer the matlab code below. and i want to know why we are using jtcp ??And one more help need please explain below code,actually what these lines are? its my kind request"
dynamicJavaClassPath = javaclasspath('-dynamic');
for i=1:100
try
%i
% jTcpObj = jtcp('request','10.176.46.57',1066,'timeout',600);%client:
jTcpObj = jtcp('request','10.176.14.44',1066,'timeout',60);%client:
break;
catch
end
end
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % d1=[];
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % d2=[];
% try
for m=1:lengOfLoop
jTcpObj.dataOutputStream.flush;
if isequal (mod(m,2),0)
jTcpObj.dataOutputStream.flush;
%jTcpObj.outputStream.reset;
end
Data=[];
Data=(handles.eegData(m,:));
Data=typecast(Data,'int8');
% Data=cat(2,Data,int8('\n'));
jtcp('write',jTcpObj,Data);
%pause (0.0001);
if isempty(jTcpObj)
jTcpObj.outputStream.reset;
jtcp('close',jTcpObj);%client:
disp ('Error occured..........')
break;
end
jTcpObj.dataOutputStream.flush;
%jTcpObj.outputStream.reset;
end
jTcpObj.outputStream.reset;
jtcp('close',jTcpObj);%client:
disp ('Data Transfer Completed')
% catch e
% jTcpObj.outputStream.reset;
% jtcp('close',jTcpObj);%client:
% e
% disp ('Exception occured: Data Transfer Not Completed')
% end
end
0 commentaires
Réponse acceptée
Walter Roberson
le 16 Déc 2021
My speculation is that the person who wrote the code did not want to rely on the Instrument Control Toolbox in the days before MATLAB made tcpclient() part of regular MATLAB, so they used Java instead.
The code opens a tcp connection to port 1066 on a host in a private network. Port 1066 has no standard program associated with it, so we can assume that the server is running a custom program.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Interface-Based Instrument Communication dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!