Why we are using jtcp function in MATLAB?

6 Ansichten (letzte 30 Tage)
Deepu S S
Deepu S S am 16 Dez. 2021
Kommentiert: Walter Roberson am 27 Dez. 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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Dez. 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 Kommentare
Deepu S S
Deepu S S am 27 Dez. 2021
@Walter Roberson tcpclient() is it support in MATLAB2018a
Walter Roberson
Walter Roberson am 27 Dez. 2021
R2014b and later.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by