made recv less blocking
keep alive and other fixes