Ana,
The synchronous version in fact does not use twisted and can be installed and run without the other dependencies (simply comment them out in the setup.py).
As for the errors, they are causes by me not finding a good way to keep the sever thread listening until the client disconnects. In this case, an error should be thrown and the polling loop should exit. Anyways, that wasn't happening and I didn't get a chance to fix it (see the handle function in sync.py). As for the client failing the last assert, I would news to check that out as it should work fine.
Anyways, I am open to suggestions on how to fix the server, otherwise I can work on fixing it when I return from my trip.
Galen
On Aug 25, 2011 12:34 PM, "anana" <anr...@hotmail.com> wrote:
>
> Hello again,
>
> Coming forward with the synchronous TCP server, thank you for the
> help, this is a very useful tool!
>
No problem; I am glad you are finding it useful.
> I have a new issue: how to initialize the data store.
> Is it needed?
The data store is needed if you are planning on saving or retrieving data.
If I later try to save a value in a higher register,
> will it produce a validation exception?
Yes
Why not initializing it to
> Modbus maximal size (according to Modbus application protocol 1.1b
> "For each of the primary tables, the protocol allows individual
> selection of 65536 data items")?
>
Because many devices (read: the ones I had to emulate) do not use the full data space. I should make it easier to null populate the full space though.
> I still don't understand why the Server context is made out of a slave
This is because a server can actually point to many different contexts or devices. Meaning, you can write to register 1 of 255 contexts.
> context and what this single=True means.
>
This means that regardless of what context you request, it will always point to the same one. Meaning, register 1 of context 1 is the same as register 1 of context 255.
On Aug 26, 2011 10:04 AM, "anana" <anr...@hotmail.com> wrote:
>
> So you mean, if single=True, we have one only context with until four
> modules (discrete inputs, coils, input registers and holding
> registers), each of them with until 65536 registers.
> But if single=x our server will manage the data of x other devices
> with different identifiers? Each of these devices could then write and
> read on the other, with the help of our server?
>
So you would set single=False and then supply a dictionary of the contexts for each context:
(slaves={0:c1, 1:c2}, single=False)
I will make the documentation more explicit and possibly easier to initialize.