implementation for writefds