From bdb267b9f445e929f765b481c038edbd6310ce85 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 20 Dec 2011 17:13:28 -0800 Subject: usrp2: added bind option to the relay --- host/examples/network_relay.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'host/examples') diff --git a/host/examples/network_relay.cpp b/host/examples/network_relay.cpp index 6ecf27858..8909c7530 100644 --- a/host/examples/network_relay.cpp +++ b/host/examples/network_relay.cpp @@ -182,19 +182,21 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ //variables to be set by po std::string addr; + std::string bind; //setup the program options po::options_description desc("Allowed options"); desc.add_options() ("help", "help message") - ("addr", po::value(&addr)->default_value(""), "the resolvable address of the usrp") + ("addr", po::value(&addr), "the resolvable address of the usrp (must be specified)") + ("bind", po::value(&bind)->default_value("0.0.0.0"), "bind the server to this network address (default: any)") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); //print the help message - if (vm.count("help")){ + if (vm.count("help") or not vm.count("addr")){ std::cout << boost::format("UHD Network Relay %s") % desc << std::endl << "Runs a network relay between UHD on one computer and a USRP on the network.\n" @@ -204,11 +206,11 @@ int UHD_SAFE_MAIN(int argc, char *argv[]){ } { - boost::shared_ptr ctrl(new udp_relay_type("0.0.0.0", addr, "49152")); - boost::shared_ptr rxdsp0(new udp_relay_type("0.0.0.0", addr, "49156", 0, tx_dsp_buff_size, rx_dsp_buff_size, 0)); - boost::shared_ptr txdsp0(new udp_relay_type("0.0.0.0", addr, "49157", tx_dsp_buff_size, 0, 0, tx_dsp_buff_size)); - boost::shared_ptr rxdsp1(new udp_relay_type("0.0.0.0", addr, "49158", 0, tx_dsp_buff_size, rx_dsp_buff_size, 0)); - boost::shared_ptr gps(new udp_relay_type("0.0.0.0", addr, "49172")); + boost::shared_ptr ctrl (new udp_relay_type(bind, addr, "49152")); + boost::shared_ptr rxdsp0(new udp_relay_type(bind, addr, "49156", 0, tx_dsp_buff_size, rx_dsp_buff_size, 0)); + boost::shared_ptr txdsp0(new udp_relay_type(bind, addr, "49157", tx_dsp_buff_size, 0, 0, tx_dsp_buff_size)); + boost::shared_ptr rxdsp1(new udp_relay_type(bind, addr, "49158", 0, tx_dsp_buff_size, rx_dsp_buff_size, 0)); + boost::shared_ptr gps (new udp_relay_type(bind, addr, "49172")); std::signal(SIGINT, &sig_int_handler); std::cout << "Press Ctrl + C to stop streaming..." << std::endl; -- cgit v1.2.3