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); } }
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); } } }
protected void RaiseOnClientConnected(Client Client) { if (MultithreadedCallbacks) { if (OnClientConnected != null) { CallbackUtilities.InvokeCallback(OnClientConnected.Invoke, Client); } } else { AddEvent(new ClientConnectedEvent(Client)); } }
protected void HandleReceivedBuffer(Client Sender, BufferStream Buffer) { if (MultithreadedCallbacks) { if (OnBufferReceived != null) { CallbackUtilities.InvokeCallback(OnBufferReceived.Invoke, Sender, Buffer); } } else { AddEvent(new BufferReceivedvent(Sender, Buffer)); } }
protected void RaiseOnConnectionFailedEvent() { if (MultithreadedCallbacks) { if (OnConnectionFailed != null) { CallbackUtilities.InvokeCallback(OnConnectionFailed.Invoke); } } else { AddEvent(new ConnectionFailedEvent()); } }
protected void HandleClientDisconnection(Client Client) { if (MultithreadedCallbacks) { if (OnClientDisconnected != null) { CallbackUtilities.InvokeCallback(OnClientDisconnected.Invoke, Client); } CloseClientConnection(Client); } else { AddEvent(new ClientDisconnectedEvent(Client)); } }
protected override void HandleDisconnection(Socket Socket) { base.HandleDisconnection(Socket); if (MultithreadedCallbacks) { if (OnDisconnected != null) { CallbackUtilities.InvokeCallback(OnDisconnected.Invoke); } } else { AddEvent(new DisconnectedEvent()); } IsConnected = false; }