Fixed memory leaks

Ran valgrind with --leak-check=full option
Changed default log properties
Make socket always non-blocking
Made socket read/write waiting to functions
Use non-blocking socket in client connection
Use non-blocking socket in listener
Connect to localhost