Exemplo n.º 1
0
        protected override void ProcessEvent(EventBase Event)
        {
            ServerEventBase ev = (ServerEventBase)Event;

            if (ev is ClientConnectedEvent)
            {
                if (OnClientConnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnClientConnected.Invoke, ev.Client);
                }
            }
            else if (ev is ClientDisconnectedEvent)
            {
                if (OnClientDisconnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnClientDisconnected.Invoke, ev.Client);
                }

                CloseClientConnection(ev.Client);
            }
            else if (ev is BufferReceivedvent)
            {
                CallbackUtilities.InvokeCallback(OnBufferReceived.Invoke, ev.Client, ((BufferReceivedvent)ev).Buffer);
            }
        }
Exemplo n.º 2
0
        protected override void ProcessEvent(EventBase Event)
        {
            ClientEventBase ev = (ClientEventBase)Event;

            if (ev is ConnectedEvent)
            {
                if (OnConnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnConnected.Invoke);
                }
            }
            else if (ev is ConnectionFailedEvent)
            {
                if (OnConnectionFailed != null)
                {
                    CallbackUtilities.InvokeCallback(OnConnectionFailed.Invoke);
                }
            }
            else if (ev is DisconnectedEvent)
            {
                if (OnDisconnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnDisconnected.Invoke);
                }
            }
            else if (ev is BufferReceivedvent)
            {
                if (OnConnectionFailed != null)
                {
                    CallbackUtilities.InvokeCallback(OnBufferReceived.Invoke, ((BufferReceivedvent)ev).Buffer);
                }
            }
        }
Exemplo n.º 3
0
 protected void RaiseOnClientConnected(Client Client)
 {
     if (MultithreadedCallbacks)
     {
         if (OnClientConnected != null)
         {
             CallbackUtilities.InvokeCallback(OnClientConnected.Invoke, Client);
         }
     }
     else
     {
         AddEvent(new ClientConnectedEvent(Client));
     }
 }
Exemplo n.º 4
0
 protected void HandleReceivedBuffer(Client Sender, BufferStream Buffer)
 {
     if (MultithreadedCallbacks)
     {
         if (OnBufferReceived != null)
         {
             CallbackUtilities.InvokeCallback(OnBufferReceived.Invoke, Sender, Buffer);
         }
     }
     else
     {
         AddEvent(new BufferReceivedvent(Sender, Buffer));
     }
 }
Exemplo n.º 5
0
 protected void RaiseOnConnectionFailedEvent()
 {
     if (MultithreadedCallbacks)
     {
         if (OnConnectionFailed != null)
         {
             CallbackUtilities.InvokeCallback(OnConnectionFailed.Invoke);
         }
     }
     else
     {
         AddEvent(new ConnectionFailedEvent());
     }
 }
Exemplo n.º 6
0
        protected void HandleClientDisconnection(Client Client)
        {
            if (MultithreadedCallbacks)
            {
                if (OnClientDisconnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnClientDisconnected.Invoke, Client);
                }

                CloseClientConnection(Client);
            }
            else
            {
                AddEvent(new ClientDisconnectedEvent(Client));
            }
        }
Exemplo n.º 7
0
        protected override void HandleDisconnection(Socket Socket)
        {
            base.HandleDisconnection(Socket);

            if (MultithreadedCallbacks)
            {
                if (OnDisconnected != null)
                {
                    CallbackUtilities.InvokeCallback(OnDisconnected.Invoke);
                }
            }
            else
            {
                AddEvent(new DisconnectedEvent());
            }

            IsConnected = false;
        }