In this talk, we will discuss a finite time horizon optimal control problem in which the controlled state dynamics is governed by a general system of stochastic functional differential equations with a bounded memory. An infinite-dimensional Hamilton-Jacobi-Bellman (HJB) equation will be derived using a Bellman-type dynamic programming principle. It will be shown that the value function of the stochastic control problem is the unique viscosity solution of the infinite dimensional HJB equation. Some motivating examples, originated from operations research, communication networks and quantum physics, as well as some open problems will be discussed.