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

Some Modbus devices that use network connection must use CRC #65

Closed
TayYeh opened this issue Jul 21, 2020 · 1 comment
Closed

Some Modbus devices that use network connection must use CRC #65

TayYeh opened this issue Jul 21, 2020 · 1 comment

Comments

@TayYeh
Copy link

TayYeh commented Jul 21, 2020

Sorry, it may be caused by other reasons later, so close this Issue!

.............................................................................................
I use the network to read multiple Modbus devices.
Some devices can connected.
But, no response after calling ReadHoldingRegisters.
And get a exception.

...............................................................................................
ModbusFactory.CreateMaster(TcpClient);
(TcpClient.Connected is true)

Call ReadHoldingRegisters
exception:
System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at Modbus.IO.TcpClientAdapter.Read(Byte[] buffer, Int32 offset, Int32 size)
at Modbus.IO.ModbusIpTransport.ReadRequestResponse(IStreamResource streamResource)
at Modbus.IO.ModbusIpTransport.ReadResponseT
at Modbus.IO.ModbusTransport.UnicastMessage[T](IModbusMessage message)
at Modbus.Device.ModbusMaster.PerformReadRegisters(ReadHoldingInputRegistersRequest request)
at Modbus.Device.ModbusMaster.ReadHoldingRegisters(Byte slaveAddress, UInt16 startAddress, UInt16 numberOfPoints)
at Modbus.Device.ModbusIpMaster.ReadHoldingRegisters(UInt16 startAddress, UInt16 numberOfPoints)
...............................................................................................

After using other Modbus Client tools and comparing packets.
I recompile NModbus so that it can add CRC to the packet.
Confirm that ReadHoldingRegisters can work normally after testing

Not sure if my use of NModbus is correct.
If there is no problem in use.
When NModbus uses Modbus TCP, the function of setting whether CRC is enabled or not needs to be added.

Thank you!

@TayYeh TayYeh closed this as completed Jul 22, 2020
@Tbeck-91
Copy link

Tbeck-91 commented Feb 23, 2023

@TayYeh how did you resolve this issue? We're having similar communication problems and we suspect this might be it

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