Numerical methods for the optimization of nonlinear stochastic delay systems, and an application to internet regulation