Skip navigation
kahsbnxasxwasx
Currently Being Moderated

Hi,How to set the maximum number of connections of FMS on the same IP

Apr 10, 2012 10:05 PM

How to set the maximum number of connections of FMS on the same IP?

 
Replies
  • Currently Being Moderated
    Apr 10, 2012 10:36 PM   in reply to kahsbnxasxwasx

    The application.clients object available in the server side action script maintains a list of all client connected to the instance at that moment.

    You can traverse the array and compare the Client.ip property to determine the max connections coming from an ip and accordingly accept/reject connections.

     

    It can be as simple as this in the application.onConnect,

     

    application.onConnect = function(clientObj)

    {

    var totalConnections = 0;

    for (i = 0; i < application.clients.length; i++)

    {

    If (application.clients[i][ip] == clientObj[ip])

    {

                    totalConnections++;

    }

    }

    If(totalConnections > 10)

    this.rejectConnection(clientObj);

    else

    this.acceptConnection(clientObj);

    }

     

    Above piece of code is untested so you might be required to make some changes to make it work but your solution should look something like that.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points