0

This is a question to an earlier question I had posted it turn out I need to generalize it. So I have these commands:

tracker=tcpip('127.0.0.1', 20200, 'NetworkRole', 'server');
fopen(tracker);
system('"C:\PROGRA~1\..." param1 param2')

I am using the same computer to be a listening server and a client as communication of an external device to the computer. The issue is the tracker server is waiting for the client to be started (system command).

Any feedback? Thanks

Community
  • 1
  • 1
theAngryPhysicist
  • 129
  • 1
  • 5
  • 12

1 Answers1

2

It is not possible to do it in a single script. The function fopen(tracker) will always wait for a connection. This is because it is supposed that the following instructions will be executed for a client.

Your code is saying: "Wait until a new connection is stablished (fopen). Then create a new client (system)". This doesn't make sense, so you should execute the client from a different script or program.

You can check it in the Matlab information: http://www.mathworks.es/es/help/instrument/using-tcpip-server-sockets.html

As you can see they specifically say:

MATLAB Client: This code is running on a second copy of MATLAB.

phyrox
  • 2,423
  • 15
  • 23