Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I'm getting a wrong packet on fc03 #1

Closed
Brugui7 opened this issue Aug 8, 2017 · 4 comments
Closed

I'm getting a wrong packet on fc03 #1

Brugui7 opened this issue Aug 8, 2017 · 4 comments

Comments

@Brugui7
Copy link

Brugui7 commented Aug 8, 2017

With this code:

image

I'm getting this error

Message -> Read total timeout expired 
#0 C:\xampp\htdocs\modbus-tcp-client\src\Network\BinaryStreamConnection.php(137): ModbusTcpClient\Network\BinaryStreamConnection->receive() #1 C:\xampp\htdocs\modbus-tcp-client\functions\Read.php(25): ModbusTcpClient\Network\BinaryStreamConnection->sendAndReceive(Object(ModbusTcpClient\Packet\ModbusFunction\ReadHoldingRegistersRequest)) #2 {main}```

I think that the package isn't good built.
Could you help me?

Btw, this repo is about directly modbus TCP or above RTU modbus TCP ??

Nice repo!!!
@aldas
Copy link
Owner

aldas commented Aug 8, 2017

Hi, this is modbus over tcp (without crc part) http://www.simplymodbus.ca/TCP.htm

From error I can only see that this lib was able to connect to modbus master but did not get respond and therefore request timeouts. It could be as you suspect - you may have different protocol for your plc. Atm only thing that I can recommend is to try same fc3 query with same ip/tcp/port with https://github.com/MightyPork/phpmodbus library.

@aldas
Copy link
Owner

aldas commented Aug 8, 2017

just to be sure you could start debugging by checking if you actually can connect from your pc to plc modbus port

Under windows:

telnet <modbus ip> <port>

it should not give errors.

NB: this lib is only tried with "Wago PLC 750-885 ETHERNET" and atm php version I am using is 'PHP 7.1.2 (cli) (built: Feb 14 2017 21:24:49) ( ZTS MSVC14 (Visual C++ 2015) x64 )'. Just tried to query one of Wago PLCs and got answer nicely.

@aldas
Copy link
Owner

aldas commented Aug 8, 2017

and have you set php error level to be strict enough? from that picture it seems to me that you are using phpstorm and 'ReadHoldingRegistersRequest' class has not been correctly imported (gray background). It is probably not the reason for you error as for me it results Fatal error: Uncaught Error: Class 'ReadHoldingRegistersRequest' not found in

@Brugui7
Copy link
Author

Brugui7 commented Aug 8, 2017

Thank you very much for your help and fast response!

I'll try what you've say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants