refactoring of get method

for waiting connection