add alarm to implement the time out; solve the "not socket" bug