Hi,
I would like to set up a modbus communication using TCP/IP.
In order to test it, I wanted to set the communication between two Matlab sessions on the same computer and set up the communication using local IP address.
To do so, I tested the following:
m = modbus('tcpip', 'localhost');
or
m = modbus('tcpip', '127.0.0.1');
but in both case I get the following error:
Error using modbus (line 96)
Requested transport resource is either in use or does not exist. Unsuccessful open: Connection refused (Connection
refused)
Is it related to a configuration that I have not done on my computer or is it impossible to set up such a communication?
Thanks for your help.

댓글 수: 3

Walter Roberson
Walter Roberson 2018년 10월 11일
Sometimes it is firewall issues on Windows.
Ming Yue
Ming Yue 2018년 10월 15일
If you want to transfer data between two MATLAB sessions, you can consider using the "tcpip" connection. Here's an example: https://blogs.mathworks.com/loren/2011/05/27/transferring-data-between-two-computers-using-matlab/.
The example is for sending info from one MATLAB session to another (one direction), so you can setup a server and a client on each MATLAB session with different port number to communicate in both directions.
M
M 2018년 11월 14일
This was indeed a firewall issue. Thanks for your help.

댓글을 달려면 로그인하십시오.

 채택된 답변

M
M 2018년 11월 14일

0 개 추천

This was a firewall issue. Ubuntu has a built-in firewall that one can deactivate using this solution:
<https://askubuntu.com/questions/250775/how-do-i-turn-off-the-firewall-in-ubuntu-12-04>

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Modbus Communication에 대해 자세히 알아보기

질문:

M
M
2018년 10월 11일

답변:

M
M
2018년 11월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by