tuyendothanh / nmodbus

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

Modbus TCP seems to disregard multiple unit id's. #36

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Used latest version of .Net 2.0.  May be fixed in 3.0 version, but did 
not see an indication that it was.
2. In MySample\Driver.cs main call StartModbusTcpSlave only.
3. StartModbusTcpSlave modified in Driver.cs and DataStoreFactory.cs 
modified as in the attached files:

What is the expected output? What do you see instead?
Expect when I query holding registers of unit 2, get multiples of 7.  Get 
multiples of 3 instead.  It appears that somewhere in the request it is 
using a static definition of the slave rather than the slave specific to 
the unit.

What version of the product are you using? On what operating system?
1.4.0.3, XP/SP2

Please provide any additional information below.

Please inform me by email if I just coded this in error.  Thanks!

Original issue reported on code.google.com by slit...@energy-solutions.com on 5 Sep 2008 at 12:33

Attachments:

GoogleCodeExporter commented 9 years ago
The slave address is ignored when using the Modbus TCP/IP protocol, rather the 
slave 
is addressed by IP address. There are a couple of issues with your changes.

1) you are only using a single TcpListener bound to both slaves. You need to 
use a 
TcpListener per slave, bound to a seperate IP address.

2) you never invoke the listen method on the second slave. 

Original comment by sja...@gmail.com on 5 Sep 2008 at 1:36

GoogleCodeExporter commented 9 years ago
sjalex,

Thanks for the advice.  Now that does work.  No argument at all on your point 
number 
2.  I am guessing when you say I need to use a separate IP address you mean a 
different port since once process is going to run on one host generally having 
only 
one IP address.  It seems wrong that I need to have a different port.  The 
request 
message sends the unit id, for instance 1 or 2.  The slave seems to disregard 
the 
unit id in the request and just send back the one datastore that is associated 
with 
the port.  A true TCP Modbus slave should be able to handle multiple devices on 
port 
502.

Original comment by slit...@energy-solutions.com on 5 Sep 2008 at 8:35

GoogleCodeExporter commented 9 years ago

Original comment by sja...@gmail.com on 24 Nov 2008 at 6:33

GoogleCodeExporter commented 9 years ago
sjalex,

Does the status "Done" indicate that there is a fix or that it has been 
disregarded?  You gave me a work-around which is fine, but if you have truly 
fixed 
it to where unit-id is not disregarded and so you don't have to have multiple 
ports 
I would like to know this.  Also, if so, will it be available in .Net 2.0 
versions 
or just .Net 3.0+?

Regardless of whether there has been a fix, thanks for all your help.  I think 
this 
is a great product.

Original comment by slit...@energy-solutions.com on 24 Nov 2008 at 3:22

GoogleCodeExporter commented 9 years ago
At this time I've decided not to take any action on this one. Thanks for all 
your
feedback.

Changing status to WontFix.

Original comment by sja...@gmail.com on 24 Nov 2008 at 3:28

GoogleCodeExporter commented 9 years ago
Ok, thank you.

Original comment by slit...@energy-solutions.com on 24 Nov 2008 at 3:39