Fix socket accept fail check

Fix socket accept fail check by evaluating return value as boolean, also
add more informative log message
Moved client logic to Client