davidLin7692 / pymodbus

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

Each request waits for timeout - serial client #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have tried to use sync serial client in ascii mode. I have successfully 
read/written data but I have noticed long transaction times. In fact, each 
transaction waits for timeout because there is request to read 1024 bytes.
So, I have just modified 2 files to solve the problem for ascii mode serial 
client. 
I would like you to review the modification. If you like it I can do that for 
other clients. 
Changes are:
transaction.py
ModbusAsciiFramer processIncomingPacket method, it returns True if packet was 
detected, False otherwise

sync.py
ModbusTransactionManager execute method, it waits for processIncomingPacket to 
detect the packet

ModbusSerialClient _read method, it reads just one byte from the line

I would suggest introducing of frame size field in the client. It can be used 
to specify number of bytes to read in ModbusTransactionManager.execute method.

Best regards, Franis Sirkovic.

Original issue reported on code.google.com by franis.s...@gmail.com on 3 Sep 2011 at 1:30

Attachments:

GoogleCodeExporter commented 9 years ago
I would also be in favor of having something like this.

Original comment by chris.fl...@gmail.com on 9 Feb 2012 at 10:01

GoogleCodeExporter commented 9 years ago
I tried using this patch and have a problem. When trying to read several 
registers in sequence my program locks up. I have to put a time.sleep(0.01) 
statement before each read. It is much faster than the blocking read but this 
implementation might confuse people that try to use it.

Original comment by chris.fl...@gmail.com on 27 Feb 2012 at 10:15

GoogleCodeExporter commented 9 years ago

Original comment by Bashw...@gmail.com on 15 Jul 2013 at 5:09

GoogleCodeExporter commented 9 years ago
Which issue was this a duplicate of? I just tried pymodbus for the first time 
and experience the same problem as this issue. Serial requests always waits for 
the timeout before returning.

Original comment by patrik.a...@gmail.com on 18 Feb 2015 at 7:03