Thread: socket limit

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    socket limit

    Hi

    I just recently found out theres a limit for the number of sockets you can have with select model. The limit is set in FD_SETSIZE and uses fd_set structure.

    Since im working on a big application that needs to be able to do 4k+ connections, I need a much bigger limit. What would be the best way to achieve that? I could change the fd_set structure or FD_SETSIZE, or also use more threads for each fdset (1 thread for 64 sockets) but that would be useless and would take too much work and code to do it.

    What do you think it would be the best way to do that? I guess making a new fdset structure that would be allocated dynamicly.. I work with win32..

    Thanks for help

  2. #2
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275
    >1 thread for 64 sockets

    Actually for UNIX, FD_SETSIZE = 1024.

    I don't know is this an implementation limitation or a user defined limit. You can at least try to set the limit to whatever you want!

    A fd_set is actually an array of bits!

    I recommend you to check MSDN for detailed information

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Quote Originally Posted by MSDN select
    The variable FD_SETSIZE determines the maximum number of descriptors in a set. (The default value of FD_SETSIZE is 64, which can be modified by defining FD_SETSIZE to another value before including Winsock2.h.)
    ~~~~

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. socket programming question, closing sockets...
    By ursula in forum Networking/Device Communication
    Replies: 2
    Last Post: 05-31-2009, 05:17 PM
  2. Socket Help - Multiple Clients
    By project95talon in forum C Programming
    Replies: 5
    Last Post: 11-17-2005, 02:51 AM
  3. when to close a socket
    By Wisefool in forum Networking/Device Communication
    Replies: 5
    Last Post: 11-02-2003, 10:33 AM
  4. socket newbie, losing a few chars from server to client
    By registering in forum Linux Programming
    Replies: 2
    Last Post: 06-07-2003, 11:48 AM
  5. hi need help with credit limit program
    By vaio256 in forum C++ Programming
    Replies: 4
    Last Post: 04-01-2003, 12:23 AM