Change const number to sizeof
Check that socket is either connected or not.