Why we are using jtcp function in MATLAB?
4 ビュー (過去 30 日間)
古いコメントを表示
"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 件のコメント
採用された回答
Walter Roberson
2021 年 12 月 16 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interface-Based Instrument Communication についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!