split main into netdev_server, netdev_client and netdev_listen