socket-server: Added more logging and flush buffer