Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Defining FD_SETSIZE in .pro file
Forum Updated to NodeBB v4.3 + New Features

Defining FD_SETSIZE in .pro file

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 3 Posters 687 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pingal
    wrote on last edited by
    #1

    I want to increase the FD_SETSIZE to increase the number of sockets supported by select(..). According to the Microsoft, one can increase it by defining the FD_SETSIZE before <winsock2.h> or could add "-DFD_SETSIZE=128" as an option to the compiler command line for Microsoft C++.

    I've tried all the below lines in .pro files but none of them seems to work.

    DEFINES += _FD_SETSIZE=1500   
    DEFINES += FD_SETSIZE=1500
    DEFINES += -DFD_SETSIZE=1500
    

    I'm trying to avoid #IFDEF in every source file which includes <winsock2.h> therefore i'm trying to pass it to the compiler.

    kshegunovK 1 Reply Last reply
    0
    • P pingal

      I want to increase the FD_SETSIZE to increase the number of sockets supported by select(..). According to the Microsoft, one can increase it by defining the FD_SETSIZE before <winsock2.h> or could add "-DFD_SETSIZE=128" as an option to the compiler command line for Microsoft C++.

      I've tried all the below lines in .pro files but none of them seems to work.

      DEFINES += _FD_SETSIZE=1500   
      DEFINES += FD_SETSIZE=1500
      DEFINES += -DFD_SETSIZE=1500
      

      I'm trying to avoid #IFDEF in every source file which includes <winsock2.h> therefore i'm trying to pass it to the compiler.

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by
      #2

      @pingal said in Defining FD_SETSIZE in .pro file:

      I want to increase the FD_SETSIZE to increase the number of sockets supported by select(..)

      Do you use select? Also having 1500 sockets in one process is a very dubious idea to begin with ...

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pingal
        wrote on last edited by pingal
        #3

        Yes, I'm using select(..) and i'm not handling 1500 clients at a time. I'm just setting the MAX_CLIENTs just to be on the safe-side.

        How do i instruct the compiler in .pro file to include FD_SETSIZE limit ?

        kshegunovK 1 Reply Last reply
        0
        • P pingal

          Yes, I'm using select(..) and i'm not handling 1500 clients at a time. I'm just setting the MAX_CLIENTs just to be on the safe-side.

          How do i instruct the compiler in .pro file to include FD_SETSIZE limit ?

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          Provide the compile line you get from using DEFINES += "FD_SETSIZE=1500"
          Alternatively for the msvc compiler:

          *msvc*:QMAKE_CXXFLAGS+="/DFD_SETSIZE#1500"
          

          Read and abide by the Qt Code of Conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pingal
            wrote on last edited by
            #5

            "Provide the compile line you get from using DEFINES += "FD_SETSIZE=1500" "

            Sorry, I didn't get this statement.

            jsulmJ 1 Reply Last reply
            0
            • P pingal

              "Provide the compile line you get from using DEFINES += "FD_SETSIZE=1500" "

              Sorry, I didn't get this statement.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @pingal said in Defining FD_SETSIZE in .pro file:

              DEFINES += "FD_SETSIZE=1500

              Add this, build and then copy paste the compiler call, so we can see whether and how this define is passed to the compiler.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • P Offline
                P Offline
                pingal
                wrote on last edited by
                #7

                DEFINES += "FD_SETSIZE=1500" in .pro file produces below compile output:

                C:/Qt/Tools/mingw810_64/bin/mingw32-make -f Makefile.Debug
                mingw32-make[1]: Entering directory 'C:/Users/user1/Desktop/Projects/QT projects/build-untitled6-Desktop_Qt_6_0_4_MinGW_64_bit-Debug'
                g++ -c -fno-keep-inline-dllexport -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DFD_SETSIZE=1500 -D_WIN32_WINNT=0x0602 -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../untitled6 -I. -IC:/Qt/6.0.4/mingw81_64/include -IC:/Qt/6.0.4/mingw81_64/include/QtQuick -IC:/Qt/6.0.4/mingw81_64/include/QtOpenGL -IC:/Qt/6.0.4/mingw81_64/include/QtGui -IC:/Qt/6.0.4/mingw81_64/include/QtQmlModels -IC:/Qt/6.0.4/mingw81_64/include/QtQml -IC:/Qt/6.0.4/mingw81_64/include/QtNetwork -IC:/Qt/6.0.4/mingw81_64/include/QtCore -Idebug -IC:/VulkanSDK/1.0.51.0/Include -IC:/Qt/6.0.4/mingw81_64/mkspecs/win32-g++  -o debug\ClientResponse.o ..\untitled6\ClientResponse.cpp
                

                In the compiler output, it is shown as "-DFD_SETSIZE=1500"

                kshegunovK 1 Reply Last reply
                0
                • P pingal

                  DEFINES += "FD_SETSIZE=1500" in .pro file produces below compile output:

                  C:/Qt/Tools/mingw810_64/bin/mingw32-make -f Makefile.Debug
                  mingw32-make[1]: Entering directory 'C:/Users/user1/Desktop/Projects/QT projects/build-untitled6-Desktop_Qt_6_0_4_MinGW_64_bit-Debug'
                  g++ -c -fno-keep-inline-dllexport -g -std=gnu++1z -Wall -Wextra -Wextra -fexceptions -mthreads -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DFD_SETSIZE=1500 -D_WIN32_WINNT=0x0602 -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_QMLMODELS_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../untitled6 -I. -IC:/Qt/6.0.4/mingw81_64/include -IC:/Qt/6.0.4/mingw81_64/include/QtQuick -IC:/Qt/6.0.4/mingw81_64/include/QtOpenGL -IC:/Qt/6.0.4/mingw81_64/include/QtGui -IC:/Qt/6.0.4/mingw81_64/include/QtQmlModels -IC:/Qt/6.0.4/mingw81_64/include/QtQml -IC:/Qt/6.0.4/mingw81_64/include/QtNetwork -IC:/Qt/6.0.4/mingw81_64/include/QtCore -Idebug -IC:/VulkanSDK/1.0.51.0/Include -IC:/Qt/6.0.4/mingw81_64/mkspecs/win32-g++  -o debug\ClientResponse.o ..\untitled6\ClientResponse.cpp
                  

                  In the compiler output, it is shown as "-DFD_SETSIZE=1500"

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by
                  #8

                  @pingal said in Defining FD_SETSIZE in .pro file:

                  In the compiler output, it is shown as "-DFD_SETSIZE=1500"

                  Which is correct, so you should search the error elsewhere, it's not that the macro isn't defined or has the wrong value. Probably this simply isn't supported anymore (as it appears to be some sort of legacy quick-fix).

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    pingal
                    wrote on last edited by
                    #9
                    #ifndef FD_SETSIZE
                    #define FD_SETSIZE MaxClients
                    #endif
                    

                    Solved my problem, thanks

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved