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.
更多回答(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!