TCP/IP Connection refused

10 Ansichten (letzte 30 Tage)
Vahe
Vahe am 10 Sep. 2014
Beantwortet: Garabani am 25 Nov. 2021
I have server/client application. Server generating random number and sending it to client via tcp/ip. The server side code is the following:
tmr = timer('ExecutionMode', 'FixedRate', ...
'Period', 0.2, ...
'TimerFcn', {@timerCallback});
start(tmr);
where the function is:
function timerCallback(hObj, eventdata)
tcpipServer = tcpip('0.0.0.0',57000,'NetworkRole','Server');
fopen(tcpipServer);
mean = rand(1)
fwrite(tcpipServer,mean,'double');
fclose(tcpipServer);
clear all;
end
The client side code where the number is read is following:
tcpipClient = tcpip('localhost',57000,'NetworkRole','Client');
fopen(tcpipClient);
while (1)
try
number = fread(tcpipClient,1,'double');
pause(1);
catch
fclose(tcpipClient);
display('Read error');
clear all;
pause(2);
tcpipClient = tcpip('localhost',57000,'NetworkRole','Client');
fopen(tcpipClient);
end
end
This code runs for several hours, after which at client side I get the following error:
Unsuccessful open: Connection refused: connect
and the process stops.I run this code several times and the error is remains but the run times (more than 2 hours) are different.

Antworten (1)

Garabani
Garabani am 25 Nov. 2021
have you ever found the reason? I am having a similar issue but for sending webcam video from server to client.

Kategorien

Mehr zu MATLAB Parallel Server finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by