TCP server on MATLAB

4 views (last 30 days)
amro
amro on 15 Apr 2015
I can't TCP from MATLAB to MATLAB MATLAB version 2015a
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

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!