common functions used in servers, open_clientfd added