I tried the "ModBus client example" and "ModBus server example" myself today, using localhost.
As you may know, it by default uses the localhost(127.0.0.1), port 502, if the user chooses to use TCP.
When I clicked "connect" button on the server side, it showed the error message "address is protected."
Then I learned that I should've used the port number greater than 1024 to workaround this error. (I used 10000 and it worked without issues)
I know that the ModBus by default uses the port 502, but the default hardcoded port 502 not working out of the box might confuse beginners who just want to try the ModBus functionality on their laptop.
How about changing the default hardcoded port from 502 to over 1024 and adding a comment in the example description web page and the code itself why it's not 502 in the demo? such as "Usually the port used by ModBus the server and the client is 502. However, since this example application uses localhost, in order not to cause "address is protected" error, we decided to use the port greater than 1024."
I think that will make things much easier for people.