Aims and background: Network security detection has become increasingly complex due to the proliferation of Internet nodes and the ever-changing nature of network architecture. To address this, a multi-layer feedforward neural-network has been employed to construct a model for security threat detection, which has enhanced network security protection. Objectives and Methods: Improving prediction accuracy and real-time performance, this research suggests an optimal strategy based on Clockwork Recurrent-Neural-Networks(CW-RNNs) to handle nonlinearity and temporal dynamics in network security circumstances. We get the model to pick up on both the short-term and long-term temporal aspects of network-security situations by using the clock-cycle RNN. To further improve the network security scenario prediction model, we tune the network hyperparameters using the Grey-Wolf-Optimization(GWO) technique. By incorporating a clock-cycle for hidden units, the model can improve its pattern recognition capabilities by learning short-term knowledge from high-frequency update modules and preserving long-term memory from low-frequency update modules. Results: The optimized clock-cycle RNN achieves better prediction accuracy than competing network models when it comes to extracting nonlinear and temporal characteristics of network security scenarios, according to the experimental data. Conclusions: In addition, our method is perfect for tracking massive amounts of data transmitted by sensor networks because of its minimal time complexity and outstanding real-time performance.