Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 02:21

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Request]Blocking IP connections for 5165

Discussion on [Request]Blocking IP connections for 5165 within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Arrow [Request]Blocking IP connections for 5165

How can I block IPs for my 5165 server? I want to know so I can IP ban people and/or block them if they are flooding my server in any way.
copz1337 is offline  
Old 01/15/2010, 06:36   #2
 
Huseby's Avatar
 
elite*gold: 106
Join Date: Oct 2006
Posts: 6,047
Received Thanks: 1,165
#Wiped
Huseby is offline  
Thanks
1 User
Old 01/15/2010, 06:39   #3
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
This is the easiest way to do it, LetterX has a point basic winsock operation -.-
Code:
if(Socket.RemoteEndPoint.ToString().Split(':')[0] == BANNEDIPADDR)
{
   Socket.Disconnect(false);
}
Nullable is offline  
Thanks
1 User
Old 01/15/2010, 16:57   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Quote:
Originally Posted by Nullable View Post
This is the easiest way to do it, LetterX has a point basic winsock operation -.-
Code:
if(Socket.RemoteEndPoint.ToString().Split(':')[0] == BANNEDIPADDR)
{
   Socket.Disconnect(false);
}
is this all? where do I put it.
copz1337 is offline  
Old 01/15/2010, 16:59   #5
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
Quote:
Originally Posted by copz1337 View Post
is this all? where do I put it.
Just where your (i assume) asynchronous callback for accepting connections is..
Probably where you may find this line
Quote:
Socket.BeginAccept(...)
Nullable is offline  
Old 01/15/2010, 17:15   #6
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
alright um im probably putting it in the wrong place but check it out...

copz1337 is offline  
Old 01/15/2010, 17:43   #7
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
Quote:
Originally Posted by copz1337 View Post
Will it still work if I put it anywhere on my source?
Depends on the place that you will put it in..
Nullable is offline  
Old 01/15/2010, 17:46   #8
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
Quote:
Originally Posted by Nullable View Post
Depends on the place that you will put it in..
lol read my previous post i edited it.
copz1337 is offline  
Old 01/15/2010, 17:51   #9
 
elite*gold: 0
Join Date: Jan 2010
Posts: 36
Received Thanks: 12
Good job Nullable
Your good at this stuff
Sinestro is offline  
Old 01/15/2010, 17:56   #10
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
Ehm, you shouldn't have c&p'd the code, it was just a skeleton, you need to change stuff in it. .
I never used this version you are using so look for something like this from a proxy i was making a while ago:
Code:
        private void OnClientConnect(IAsyncResult Res)
        {
            string[] IPS = File.ReadAllText(Application.StartupPath + @"\BannedIPs.txt").Split('\r', '\n'); // here i read the ips that i want to block
            SocketPacket sender = null;
            try
            {
                sender = new SocketPacket(this.ProxySocket.EndAccept(Res)) { Connected = true };
                foreach (string IP in IPS)
                {
                    if (IP == sender.RemoteIP) // I created a property for the ip it is the same as Socket.RemoteEndPoint.ToString().Split(':')[0]
                    {
                        if (this.OnClientBlocked != null)
                        {
                            this.OnClientBlocked.Invoke(sender, null);
                        }
                        sender.Connected = false;
                        sender.cont = false;
                        sender.ClientSocket.Disconnect(true);
                    }
                    else
                    {
                        sender.cont = true;
                    }
                }
                if (sender.cont == true)
                {
                    ClientPool.Add(sender.UniqueID, sender);
                    if (this.OnClientConnected != null)
                        this.OnClientConnected.Invoke(sender, null);
                    if (sender.Connected)
                    {
                        sender.ClientSocket.BeginReceive(sender.dataBuffer, 0, sender.dataBuffer.Length, SocketFlags.None
                                                                    , new AsyncCallback(this.OnDataRecieve), sender);
                    }
                }
            }

            catch (Exception)
            {
                if (this.Enabled)
                {
                    sender.cont = false;
                    sender.Connected = false;
                    if (this.OnClientDisconnect != null)
                    {
                        this.OnClientDisconnect.Invoke(sender, null);
                    }
                }
            }
            finally
            {
                if (this.Enabled)
                    ProxySocket.BeginAccept(new AsyncCallback(OnClientConnect), null);
            }
Nullable is offline  
Thanks
2 Users
Old 01/15/2010, 18:44   #11
 
elite*gold: 0
Join Date: Jan 2010
Posts: 36
Received Thanks: 12
nice job nullable
This really helped me
Sinestro is offline  
Old 01/15/2010, 19:11   #12
 
Nullable's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
Quote:
Originally Posted by Sinestro View Post
nice job nullable
This really helped me
No problem
Nullable is offline  
Old 01/15/2010, 21:07   #13
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
can't i just make like a banned ip list in my oldcodb
copz1337 is offline  
Reply


Similar Threads Similar Threads
[Request] Request all 5165 sources/npc dialog
02/28/2010 - CO2 Private Server - 0 Replies
so i want to do a good source like every1 right ? so i stay some time and i got a idea to take lot of 5165 and take what's not bugged and essentialy :mofo: i will release it :D
[Help][5165] How do you change max connections?
02/12/2010 - CO2 Private Server - 0 Replies
Ive set it up for like 600 ages ago but i cant remember where it was or what the code was called could anypoint me to the right place to look for this :P thx source 5165.
[REQUEST]5165 Client Request Help/ Question
12/18/2009 - CO2 Private Server - 5 Replies
hey yall its me TheLeGend Im Back in CO for a while but i gots a question ok so i have a 5165 Client im editing for a server but the only problem is that stupid-ass popup page that comes up the Conquer Online - Official Site - co.91.com one well i was just wondering how can i edit that site orrr how can i make it not popup anymore??? Thanks so Much, TheLeGend209



All times are GMT +1. The time now is 02:24.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.