socks5.Socks5Server._server_onClientConnected C# (CSharp) Method

_server_onClientConnected() public method

public _server_onClientConnected ( object sender, ClientEventArgs e ) : void
sender object
e socks5.TCP.ClientEventArgs
return void
        void _server_onClientConnected(object sender, ClientEventArgs e)
        {
            //Console.WriteLine("Client connected.");
            //call plugins related to ClientConnectedHandler.
            foreach (ClientConnectedHandler cch in PluginLoader.LoadPlugin(typeof(ClientConnectedHandler)))
            {
                try
                {
                    if (!cch.OnConnect(e.Client, (IPEndPoint)e.Client.Sock.RemoteEndPoint))
                    {
                        e.Client.Disconnect();
                        return;
                    }
                }
                catch
                {
                }
            }
            SocksClient client = new SocksClient(e.Client);
            e.Client.onDataReceived += Client_onDataReceived;
            e.Client.onDataSent += Client_onDataSent;
            client.onClientDisconnected += client_onClientDisconnected;
            Clients.Add(client);
            client.Begin(this.OutboundIPAddress, this.PacketSize, this.Timeout);
        }