Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107142

Modbus demo may need to use port greater than 1024



    • All


      I tried the "ModBus client example" and "ModBus server example" myself today, using localhost.

      As you may know, it by default uses the localhost(, 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.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            docteam Qt Documentation Team
            mikio_hirai Mikio Hirai
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes