decrease duration for fopen (tcpip-socket) timeout.

조회 수: 6 (최근 30일)
Pratched
Pratched 2018년 9월 26일
편집: Soc 2020년 3월 12일
Hello everybody,
is there any way to decrease the duration in which matlab will try to 'fopen' to a specific tcpip-defined adress?
ip = ['141.76.14.126' '127.0.0.1'];
port = 1;
instr = tcpip(ip(1),port);
% set(sma,'Timeout',2); % will change the desired 'Timeout'-property, but has no effect
tic
try
fopen(instr);
catch
end
toc
As you may notice the time required between ip(1) and ip(2) differs about 20 s which will be due to timeout of ip(1). Is there any way in matlab to decrease the difference between ip(1) and ip(2)? The commented line is working but does not affect anything.
Any suggestion, even words to search are much appreciated. Thanks in advance.
  댓글 수: 1
Soc
Soc 2020년 3월 12일
편집: Soc 2020년 3월 12일
Any reason why you're setting 'Timeout' on 'sma', not on 'instr'?
I am also running into this issue: fopen seems to ignore the Timeout property of tcpip objects. It seems that Timeout is only considered for read/write operations but not the initial opening. So far the only workaround I've found is here, which refers to File Exchange timeout. However, this relies on ctrl-c'ing out of the script which is often undesirable.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by