TCP server on MATLAB

2019-04-14 11:45发布

问题:

I can't TCP from MATLAB to MATLAB

Server Code:

 t = tcpip('192.168.1.14', 8000, 'NetworkRole', 'Server');
    set(t, 'InputBufferSize', 900000);


fprintf('waiting for client \n');
fopen(t);
fprintf('client connected');

MATLAB waiting for client when I use fopen(t)

when I'm trying to connect from another PC on the same network I use this Code:

tc = tcpip('192.168.1.14', 8000,'NetworkRole','Client');
fopen(tc)

on the Client PC return no errors after fopen(tc) 'that's mean the Server is working fine

but on the Server PC .. It still waiting for client without detecting the Client and jump to fprintf('client connected');

when I tried both of these codes on the same PC using different versions of MATLAB it worked fine on the server and Client .. ....... there is another problem there .. I don't need the code to be paused for waiting a client I need there is no Client: do something If client exist do something else

Thank you