Results 1 to 6 of 6

Thread: [RESOLVED] Blocking New Connections - Help Needed

  1. #1

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Resolved [RESOLVED] Blocking New Connections - Help Needed

    pls can anyone tell me how to block new connections in winsock
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Blocking New Connections - Help Needed

    New connections to what? From what?

  3. #3

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Blocking New Connections - Help Needed

    i have a chat winsock app that must block new connections when a total of 12 connections have been established by 12 different ip.
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  4. #4
    Lively Member
    Join Date
    May 2005
    Posts
    90

    Re: Blocking New Connections - Help Needed

    I assume you've have to be using an array of Sockets for that - why can't you just keep note of how many are created, then abort accepting the connection once the limit has been reached?

    I always setup a static array defined as socket objects, then create a second array of booleans that indicate if the corresponding location in the Socket array is in use. Then, I loop through my sockets and find empty places to create new ones. Likewise, I remove the socket when I'm done. In my case, I'd just count the number of Trues in my array of booleans to determine how many connections I have.

    Good luck!
    ^_^

  5. #5
    Addicted Member
    Join Date
    Dec 2005
    Posts
    198

    Re: Blocking New Connections - Help Needed

    I'm developing a chat application too. I work with serialized objects, wich are received and sent back from and to the server, respectively. What I do is really simple, I define an static var, wich is increased when a client connects to the server and decreased when he disconnects from it. I also keep a private const that contains number of users that will be accepted simultaneously. When you receive a new connection, the only thing you have to do is to check if static var is equal to private const. In that case you must say to the client that his try of connection has failed. And for doing that you will always have to first accept the socket, independently of the current number of user connected, and then do the condicional sentence.
    It's just the way that I'm working with that.
    I hope that you find it useful at least.
    Regards!.

  6. #6

    Thread Starter
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: Blocking New Connections - Help Needed

    i found a way out of it.

    thanks
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width