[QUESTION]How do I block IPs?

11/23/2009 22:54 airborne.#1
title. i use the new 5165 source. Btw in other words, how do I ip ban someone.
11/24/2009 07:19 hunterman01#2
just do

if(*charname*)
{
Csocket.break;
}

done.... thats not really ipbanning but i mean it gets the job done
11/24/2009 07:21 Arcо#3
Quote:
Originally Posted by hunterman01 View Post
just do

if(*charname*)
{
Csocket.break;
}

done.... thats not really ipbanning but i mean it gets the job done
People can just make more chars can they not?
11/24/2009 07:28 hunterman01#4
Yeah they can thats just a quick fix for annoying people : /
11/24/2009 11:11 Korvacs#5
Best way would be a table with a list of IPAddresses which are blocked, then perform an SQL Query to see if the Table contains the IPAddress you wish to block, if it does then reject the connection.

It would look something like this.

Code:
            if (Database.Lookup.BannedIp(Incomming.RemoteEndPoint.ToString()))
            {
                Incomming.Disconnect(false);
            }
The SQL lookup will lookup the ipaddress as a string. You will need to write that yourself for your specific database setup.

This should be performed by the auth server so that the gameserver doesnt have to waste resources on the connection.
11/24/2009 17:34 airborne.#6
Quote:
Originally Posted by Korvacs View Post
Best way would be a table with a list of IPAddresses which are blocked, then perform an SQL Query to see if the Table contains the IPAddress you wish to block, if it does then reject the connection.

It would look something like this.

Code:
            if (Database.Lookup.BannedIp(Incomming.RemoteEndPoint.ToString()))
            {
                Incomming.Disconnect(false);
            }
The SQL lookup will lookup the ipaddress as a string. You will need to write that yourself for your specific database setup.

This should be performed by the auth server so that the gameserver doesnt have to waste resources on the connection.
can you be more specific on how to add this?
11/24/2009 18:21 SimplyPerfection#7
Quote:
Originally Posted by airborne. View Post
can you be more specific on how to add this?
Wherever you have your incoming connections, probably in a void called Auth, you need to check if the client's IP is registered in your database. If it isn't, it continue, else, it breaks.