tuyendothanh / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

Modbus TCP slave is not RFC 793-compliant #54

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run your slave software
2. Send a modbus TCP/IP ADU request with one byte per TCP segment (this is 
legal according to RFC 793). Maybe this can be achieved by lowering the MTU of 
the network interface, otherwise a socket tool is needed to force the 
segmentation.

What is the expected output? What do you see instead?
I see error messages when the 6 first bytes of the mbap header, and the 
remaining ADU are not received as one segment.
RFC 793 describes the TCP as "a stream of octets", where no assumptions can be 
made about segmentation: There is no guarantee that the full ADU will be 
delivered as one segment by the TCP-interface. A stream of octets is the way to 
think of the incoming TCP data.

What version of the product are you using? On what operating system?
NModbus_net-2.0_1.11.0.0 on Windows XP Pro 2002 SP3

Please provide any additional information below.
A fix has been implemented in ModbusMasterTcpConnection.cs, this will be 
uploaded when reviewed and tested.

Original issue reported on code.google.com by langeman...@gmail.com on 21 Jul 2010 at 11:16

GoogleCodeExporter commented 9 years ago
 I have made a fix for this that seems to work, but more testing will always be beneficial :-)

The method ReadDataFromMaster assembles the modbus packages before passing them 
on.
I was tempted to include checks for increasing transactionsID's as part of the 
header check. Unfortunately it seems like increasing the transactionID is 
optional.

Original comment by mich...@stoettrup.net on 21 Jul 2010 at 1:03

Attachments: