network: factor out bind-listening code

Introduce ff_listen_bind, to be shared with the other non-tcp
network protocols.
network: factor out connect-listening code

Introduce ff_listen_connect, to be shared with the other
non-tcp network protocols.