NWT.Stuff
Things are working well and steady.  I'm looking to ramp up the comms frequencies now.

How many concurrent sockets can be Open at one time ?

Also do you have an idea of how many socket open and closes can take place in a second ?  A conservative estimate or link to a project that worked well would be great.

Many Thanks In advance, Kevin
Quote 0 0
thiagoralves
OpenPLC accepts a max of 5 pending connections, but this can be easily changed at OpenPLC_v3/webserver/core/server.cpp line 124. The number of concurrent connections will depend largely on your hardware. From my experience, it is a lot better to maintain the socket open all the time than close/open sockets at each request. There is a large overhead associated with the socket open/close (thread creation, binding socket, tons of system calls). So if you can just let the socket open and make requests as you go, that’s better
Quote 1 0
NWT.Stuff
Thanks Thiago.  5 Should be enough for me.  Was more than kind of expecting it's not a good idea to Open & Close sockets too regularly.  I guess I was just hoping that I dodn't have to write more software 🙂. Means my next job is to tweak the phpModbus package that I am using.  FYI https://github.com/krakorj/phpmodbus

Do you think the best way to recover the socket ID is to interrogate the PLC logstream (as explained in a previous post) ?
Quote 0 0
thiagoralves
Why do you need the socket ID for? This is an internal information used only on the OpenPLC core to handle the file descriptor
Quote 0 0
NWT.Stuff
Just assumed I might need it 🙂 Next job is read the modbus spec with regards to Opening & Closing Sockets.
Quote 0 0
thiagoralves
There isn't much to worry about opening & closing sockets. Those are normal TCP sockets, handled by the OS. Modbus is just the payload.
Quote 0 0
NWT.Stuff
Chipping away 🙂.   Just a couple of questions regarding the connections. More from an understanding point of view than "need to know".

The Client_ID shown on the monitoring screen.  How is this resolved e.g. Client 10 = first request from IP address #1. What are the unique identifiers for Client 10 ?

When are these Client_ID numbers reset ? e.g. when I stop & start the PLC do we go back to 10 being the first one ?

Many Thanks in Advance, Kevin
Quote 0 0
thiagoralves
This is handled by the operating system, not OpenPLC, so I have no control of this. As I told you, socket handling is a low level OS thing, not for you to worry.
Quote 1 0
NWT.Stuff
Sure I'll get my head around it. In Python it's easy(ish). In PHP less so 🙂
Quote 0 0