fix some socket build issues, implement timed out wait on condition