private void OnNewConnection(object Sck) { NewConnectionEventHandler handler = NewConnection; if (handler != null) { handler(this, Sck as Socket); } }
private void RaiseNewConnectionEvent(object socket_) { Socket socket = (Socket)socket_; //use a temporary copy to avoid the case a unsubscription after a null was checked NewConnectionEventHandler tempHandler = EventNewConnection; if (tempHandler != null) { tempHandler(this, new NewConnectionEventArgs(socket)); } }