Added thread sleep for socket connection