sync with dCache code. Add non blocking sockets