Improved serverside socket logic

- Improved serverside socket logic.
- Improved the Profiler class.