أهلا وسهلا بك زائرنا الكريم في فوكس كونكر - 🦊 - Conquer، لكي تتمكن من المشاركة ومشاهدة جميع أقسام المنتدى وكافة الميزات ، يجب عليك إنشاء حساب جديد بالتسجيل بالضغط هنا أو تسجيل الدخول اضغط هنا إذا كنت عضواً .

   
   







افتراضي سوكت جديد لتخفيف البنج

بسم الله وصلاة واسلام علي سيدنا محمد رصول الله اليوم معانا سوكت كويس لتظبيت البنج وا اللعبه وا Fbs نبدا التركيب 1_ .. htjvhqd s,;j []d] gjotdt hgfk[



30-01-2020 09:59 صباحا
ElSaher
menu_open
عضو مشارك
rating
معلومات الكاتب ▼
تاريخ الإنضمام : 14-08-2019
رقم العضوية : 1457
المشاركات : 68
الجنس : ذكر
تاريخ الميلاد : 5-12-1999
الدعوات : 4
قوة السمعة : 20
بسم الله وصلاة واسلام علي سيدنا محمد رصول الله

اليوم معانا سوكت كويس لتظبيت البنج وا اللعبه وا Fbs

نبدا التركيب

1_ServerSocket


 
كود:
namespace ElSaher.Network.Sockets
{
    
using System;
    
using System.Collections.Concurrent;
    
using System.Net;
    
using System.Net.Sockets;
    
using System.Runtime.InteropServices;
    
using System.Threading;
    
using ElSaher;

    public 
delegate void NetworkClientConnection(ClientWrapper client);
    public 
delegate void NetworkClientReceive(Byte[] bufferInt32 lengthClientWrapper client);

    public class 
ServerSocket
    
{
        public 
Socket Socket get; private set; }
        public 
IPEndPoint LocalEndPoint get; private set; }
        public 
String Name get; private set; }

        public 
NetworkClientConnection OnConnect;
        public 
NetworkClientReceive OnReceive;
        public 
NetworkClientConnection OnDisconnect;
        public 
BruteForceAttackProtection AttackProtector;

        public 
Int32 ClientBufferSize;

        public 
ServerSocket(String nameUInt32 maximumUInt32 banTime)
        {
            
Name name;
            
AttackProtector = new BruteForceAttackProtection(maximumbanTime);
        }

        
/*
         The Set IP Protection Level m*ethod enables restricting an a IPv6 or IP socket to listen on a specified scope, such as addresses with the same link local or site local prefix. This socket option enables applications to place access restrictions on IPv6 or IP sockets. Such restrictions enable an application running on a private LAN to simply and robustly harden itself against external attacks. This socket option can also be used to remove access restrictions if the level parameter is set to Unrestricted. This socket option widens or narrows the scope of a listening socket, enabling unrestricted access from public and private users when appropriate, or restricting access only to the same site, as required.

        This socket option has defined protection levels specified in the IPProtectionLevel enumeration.

        The SetIPProtectionLevel m*ethod is used to enable or disable Network Address Traversal (NAT) for a Socket instance. NAT traversal may be provided using Teredo, 6to4, or an ISATAP tunnel.

        When the level parameter is set to EdgeRestricted, or Restricted, this explicitly disables NAT traversal for a Socket instance.

        When the level parameter is set to EdgeRestricted, this may allow NAT traversal for a Socket depending on firewall rules in place on the system. 
        */
        
public void Prepare(int portIPProtectionLevel protectionLevel)
        {
            
LocalEndPoint = new IPEndPoint(IPAddress.Anyport);
            
Socket = new Socket(AddressFamily.InterNetworkSocketType.StreamProtocolType.Tcp);
            
Socket.Bind(LocalEndPoint);
            
Socket.SetIPProtectionLevel(protectionLevel);
            
Socket.NoDelay true;
            
Socket.Listen((int)SocketOptionName.MaxConnections);
        }

        public 
void BeginAccept()
        {
            
Socket.SetSocketOption(SocketOptionLevel.SocketSocketOptionName.KeepAlivefalse);
            
Socket.SetSocketOption(SocketOptionLevel.SocketSocketOptionName.DontLingertrue);
            
Socket.BeginAccept(Acceptnull);
        }

        private 
void Accept(IAsyncResult result)
        {
            
Socket clientSocket;

            try
            {
                
clientSocket Socket.EndAccept(result);
            }
            catch (
SocketException)
            {
                
BeginAccept();
                return;
            }

            if (
AttackProtector.Authenticate(clientSocket))
            {
                
clientSocket.ReceiveBufferSize ClientBufferSize;
                var 
client = new ClientWrapper(thisclientSocketClientBufferSize);
                
InvokeOnConnect(client);
                
client.BeginReceive();
            }
            else
                
clientSocket.Disconnect(false);
            
BeginAccept();
        }

        public 
void InvokeOnConnect(ClientWrapper client)
        {
            if (
OnConnect != nullOnConnect(client);
        }

        public 
void InvokeOnReceive(Byte[] bufferInt32 lengthClientWrapper client)
        {
            if (
OnReceive != nullOnReceive(bufferlengthclient);
        }

        public 
void InvokeOnDisconnect(ClientWrapper client)
        {
            if (!
client.IsAlive) return;

            
//   client.IsAlive = false;

            
if (OnDisconnect != nullOnDisconnect(client);
        }
    }

_ClientWrapper
 
كود:
namespace ElSaher.Network.Sockets
{
    
using System;
    
using System.Collections.Generic;
    
using System.Net.Sockets;
    
using System.Runtime.InteropServices;
    
using System.Threading;
    
using ElSaher;
    
using System.Net;

    public class 
ClientWrapper
    
{
        public 
Socket Socket get; private set; }
        public 
ServerSocket Server get; private set; }
        public 
IPEndPoint RemoteEndPoint get; private set; }
        private 
readonly byte[] _buffer;
        public 
object Owner;
        public 
Boolean IsAlive get { return Socket.Connected; } }

        public 
String IP
        
{
            
get
            
{
                if (
Socket != null)
                    return (
Socket.RemoteEndPoint as IPEndPoint).Address.ToString();
                else
                    return 
null;
            }
        }

        public 
ClientWrapper(ServerSocket serverSocket socketInt32 bufferLength)
        {
            
//IsAlive = true;
            
Server server;
            
Socket socket;
            
_buffer = new byte[bufferLength];
            
RemoteEndPoint = (IPEndPoint)Socket.RemoteEndPoint;
            
Socket.NoDelay true;
        }

        public 
void BeginReceive()
        {
            try
            {
                
Socket.BeginReceive(_buffer0_buffer.LengthSocketFlags.None, new AsyncCallback(Receive), null);
            }
            catch (
SocketException)
            {
                
Server.InvokeOnDisconnect(this);
            }
        }

        private 
void Receive(IAsyncResult result)
        {
            if (
Socket != null)
            {
                try
                {
                    
SocketError error;
                    
Int32 length Socket.EndReceive(resultout error);
                    if (
IsAlive && error == SocketError.Success)
                    {
                        if (
length 0)
                        {
                            try
                            {
                                
Server.InvokeOnReceive(_bufferlengththis);
                            }
                            catch (
Exception e)
                            {
                                
System.Console.WriteLine(e.ToString());
                            }
                            finally
                            {
                                
BeginReceive();
                            }
                        }
                        else
                        {
                            
Server.InvokeOnDisconnect(this);
                        }
                    }
                }
                catch (
SocketException)
                {
                    
Server.InvokeOnDisconnect(this);
                }
            }
        }
        public 
void Send(byte[] packet)
        {
            if (
IsAlive)
            {
                try
                {
                    
Socket.BeginSend(packet0packet.LengthSocketFlags.None, new AsyncCallback(EndSend), null);
                }
                catch (
SocketException)
                {
                    
Server.InvokeOnDisconnect(this);
                }
            }
        }

        private 
void EndSend(IAsyncResult result)
        {
            try
            {
                
Socket.EndSend(result);
            }
            catch (
SocketException)
            {
                
Server.InvokeOnDisconnect(this);
            }
        }

        public 
void Disconnect()
        {
            try
            {
                
Socket.Disconnect(false);
            }
            catch (
SocketException)
            {
            }
            
Server.InvokeOnDisconnect(this);
        }

        public 
override string ToString()
        {
            return 
RemoteEndPoint.ToString();
        }
    }

بلتوفيق يا رجاله
 

آخر مواضيع القسم
  1. دورة السي شارب #c الجزء الثاني - الفصل صفر – أساسيا تعلم تغير لون النافذة ولون الخط
  2. دورة السي شارب #C الجزء الاول - مقدمة
  3. التعديل live علي اي حجه ف GUI اللعبه
  4. حل مشكله الويند ولكر ال بيضرب في التون
  5. Update XMeGo Loader 2d 6609 Soon
  6. برنامج لفك وتشفير ملف GameLoadInfo المستخدم ف الاوتو باتش
  7. حصريا اقوي لودر لتانى مره MeGo لاصدار 6711 كامل
  8. دومين دوت كوم للعبتك مجانا مدي الحياه وتسجل بيه على التوب 100 - Free Domain .com
  9. تحميل اشكال ايتمات وتون وعناصر واستلات كونكر الجديده تو دي 2 دي 2D
  10. ازاي تعمل كويست بالهدايا اللي تعجبك



:. كاتب الموضوع ElSaher ، المصدر: افتراضي سوكت جديد لتخفيف البنج .:

htjvhqd s,;j []d] gjotdt hgfk[


12-02-2020 03:54 صباحا
مشاهدة مشاركة منفردة [1]
ابو ريتاج
menu_open عضوية موثقة
الادارة
معلومات الكاتب ▼
تاريخ الإنضمام : 20-12-2018
رقم العضوية : 1
المشاركات : 1116
الدولة : مصر
الجنس : ذكر
تاريخ الميلاد : 29-10-1984
الدعوات : 84
قوة السمعة : 4950
موقعي : زيارة موقعي
عدد الإجابات: 315
look/images/icons/i1.gif افتراضي سوكت جديد لتخفيف البنج
تسلم ايدك الله ينور
توقيع :ابو ريتاج
~ سبحان الله وبحمده , سبحان الله العظيم , أستغفرالله وأتوب إليه ~
9FNbRuW
وما توفيقى الا بالله
My reconcile of my God Almighty

 
 




الأعضاء الذين شاهدوا الموضوع: 14
ابو ريتاج ، elsawaf9193 ، Amin Ebrahim ، batanony ، Elijah ، sheiipl ، dragonwarsco ، momo24 ، eslam0124 ، YuRi ، osama2019 ، menorjc ، yousef here ، Rage250 ،

الكلمات الدلالية
لا يوجد كلمات دلالية ..


 







الساعة الآن 12:52 مساء