Updated server scripts for reusable sockets and fixed bugs in error-handling