make nonblock operation has been done in createSocket, remov repeating code