Why we are using jtcp function in MATLAB?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Deepu S S
il 16 Dic 2021
Commentato: Walter Roberson
il 27 Dic 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 Commenti
Risposta accettata
Walter Roberson
il 16 Dic 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 Commenti
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!