Exceptional server c++

How to solve this??.Please help me in the logic and implemetation

The problem-