Register for your free account! | Forgot your password?

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

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

Advertisement



Getting IPs from socket

Discussion on Getting IPs from socket within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
Getting IPs from socket

I am currently trying to get the IPs from sockets without calling
Code:
soc.EndAccept(IAsyncResult result)
method to set the socket yet I can't find a way to get the remote adress without this method (which gives errors and blocks login in case of a spam, resulting in incapacity of stopping the spamming IPs)

Is there any alternative to get the adress of the remote user without calling this method?

This is what I use

Code:
    public class Wrapper
    {
        public byte[] buffer;
        public Socket _socket;
        public object connector;
    }
        private void AcceptConnections(IAsyncResult result)
        {
                Wrapper wr = result.AsyncState as Wrapper;
             [B]   [COLOR="Red"]wr._socket = _socket.EndAccept(result);[/COLOR][/B]
                //receive data
                //send data for a new connection
                //accept new connections
        }
Any ideeas are appreciated
ryuchetval is offline  
Old 03/02/2012, 20:19   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
You cant get the IP of a connection without it being connected, which requires Accept / EndAccept.
You should use a dictionary and have a maximum amount of connections per IP. Others just disconnect them.
-impulse- is offline  
Old 03/02/2012, 20:36   #3
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
Guess I just have to limit the amount of connections per second as spamming would crash the login server. So I think that's why some of the connections couldn't be handled because there were over 100/second coming.
ryuchetval is offline  
Old 03/02/2012, 21:03   #4
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Quote:
Originally Posted by ryuchetval View Post
Guess I just have to limit the amount of connections per second as spamming would crash the login server. So I think that's why some of the connections couldn't be handled because there were over 100/second coming.
You can always give one thread to the login socket. Create a thread on which you accept socket after socket using socket.Accept().
-impulse- is offline  
Old 03/02/2012, 21:08   #5
 
elite*gold: 0
Join Date: Feb 2007
Posts: 340
Received Thanks: 38
The login is already on one thread but there can't be logged more than 1 accounts simultanously.

Yet by setting a range of time between each login will not totally fix the spam (even if it gets disconnected) I should try to block the IP automatically through Windows Firewall which I have no ideea how to set a rule to block the IP through c# so it sets it on Windows Firewall, guess I'll have to search some more.
ryuchetval is offline  
Reply




All times are GMT +1. The time now is 13:04.


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.