/// <summary> /// Called when [datagram received]. /// </summary> /// <param name="recvBuffer">The received buffer.</param> /// <param name="recvBufferSize">Size of the received buffer.</param> protected virtual void OnDatagramReceived(byte[] recvBuffer, int recvBufferSize) { EventHandler <TSocketEventArgs> handler = this.DatagramReceived; if (handler != null) { TSocketEventArgs e = new TSocketEventArgs(recvBuffer, recvBufferSize); handler(this, e); } }
/// <summary> /// Called when [client socket accepted]. /// </summary> /// <param name="clientSocket">The socket.</param> protected virtual void OnClientSocketAccepted(Socket clientSocket) { EventHandler <TSocketEventArgs> handler = this.ClientSocketAccepted; if (handler != null) { TSocketEventArgs e = new TSocketEventArgs(clientSocket); handler(this, e); } }
/// <summary> /// Called when [client socket accepted]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Simon.SharpStreamingServer.Core.TSocketEventArgs"/> instance containing the event data.</param> protected virtual void OnClientSocketAccepted(object sender, TSocketEventArgs e) { // Is the current connection count greater than the maximum // connection count? If so, we close the client socket, or // else, we add the client session as a new client session. if (this.curConnectionCount > this.maxConnectionCount) { if (this.socketListener != null) { this.socketListener.CloseClientSocket(e.ClientSocket); this.OnClientSessionRejected(); } } else { AddClientSession(e.ClientSocket); } }
/// <summary> /// Called when [datagram received]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Simon.SharpStreaming.Core.TSocketEventArgs"/> instance containing the event data.</param> protected virtual void OnDatagramReceived(object sender, TSocketEventArgs e) { HandleIncomingPacket(e.RecvBuffer, e.RecvBufferSize); }
/// <summary> /// Called when [datagram received]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="Simon.SharpStreamingServer.Core.TSocketEventArgs"/> instance containing the event data.</param> protected virtual void OnDatagramReceived(object sender, TSocketEventArgs e) { SessionLastTime = DateTime.Now; HandleIncomingRequest(e.RecvBuffer, e.RecvBufferSize); }