fangzhchen / nmodbus

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

If remote TCP connection is dropped the thread reading/writing blocks causing the CPU usuage to peg at 100% #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Start a PLC simulator on a remote PC.
2. Start the test program locally.
3. Kill the simulator.
4. Observe the CPU usage on the PC.

What is the expected output? What do you see instead?
Read/Write function should return with an error.

What version of the product are you using? On what operating system?
WinXP / Win2000 NModBus V1.0

Please provide any additional information below.
Basically in the ReadRequestResponse() method in ModbusTcpTransport.cs the
code is not looking for '0' bytes during the return.  So it keeps in the
tight loop while not reading anything.  The '0' bytes indicates that the
pipe is closed.  Attached is our solution to fix the issue.  You will
notice that we also added several more constructors.

Original issue reported on code.google.com by mccar...@att.net on 25 Apr 2007 at 7:37

Attachments:

GoogleCodeExporter commented 8 years ago
thanks, i'll add the changes to the next release.

scott

Original comment by sja...@gmail.com on 26 Apr 2007 at 5:08

GoogleCodeExporter commented 8 years ago

Original comment by sja...@gmail.com on 2 Dec 2007 at 1:37