Closed Hermit-xx closed 2 months ago
It is not possible via the API directly. You can still add custom function requests as you did in 2.5, those will be called as usual, in those use the internal transport object to obtain the ip address.
Closing as this is not a bug nor a feature request.
When using TCP Server and Not binding an IP address, it is not possible to obtain the client's IP address in the callback for read/write requests. In version 2.x,I can pass a rewritten ModbusConnectedRequestHandler class to the Server, thereby passing the client's IP address to a custom request through the handler.
However, as of version 3.6.7, it is no longer possible to pass a custom Handler to the Server.
Is there a way to obtain the IP address in the every request callback? Or how can a TCPServerClass be allowed to use a custom handler? Hope to receive a solution, thanks.
this is a part of my code in v2.5.3, its work.
StartTcpServer
CustomHandler