MATLAB: Does “fopen” fail to connect to the “tcpip” server

clientconnectionerrorfopenInstrument Control Toolboxopenrefusedservertcpipunsuccessful

Best Answer

This issue may occur if you have not opened a connection on a MATLAB with the server interface. This means, that on the machine where you run "tcpip" with "server" as the "NetworkRole", it is necessary to use "fopen" to open the connection. Make sure the server runs the following commands:
>> t = tcpip('0.0.0.0', 30000, 'NetworkRole', 'server');
>> fopen(t); % without this, there may be "Unsuccessful open: Connection refused: connect" error message
The server will be executing "fopen" and waiting for the client to connect. The server will finish executing "fopen" function the moment client connects using its own "fopen". If the server is not executing "fopen", then the client will not be able to connect.