aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-05-13 19:49:07 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-05-13 19:49:07 +0200
commit8e82b44bff75beb9b37a2261f41acce6ea8eeb25 (patch)
treef9654d437b14f28283b62cea84bc89e9d03e16cd /lib
parent20d4ef7e4a6d2dba93dd0ccd7ab9aeffdbe6fc5c (diff)
rtl_tcp: change device argument syntax to host[:port]
without any arguments the code will try to connect to localhost:1234
Diffstat (limited to 'lib')
-rw-r--r--lib/rtl_tcp/rtl_tcp_source_c.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/rtl_tcp/rtl_tcp_source_c.cc b/lib/rtl_tcp/rtl_tcp_source_c.cc
index 059e99f..5bb13e0 100644
--- a/lib/rtl_tcp/rtl_tcp_source_c.cc
+++ b/lib/rtl_tcp/rtl_tcp_source_c.cc
@@ -23,6 +23,7 @@
#include <sstream>
#include <boost/assign.hpp>
+#include <boost/algorithm/string.hpp>
#include <gr_io_signature.h>
#include <gr_deinterleave.h>
@@ -56,11 +57,16 @@ rtl_tcp_source_c::rtl_tcp_source_c(const std::string &args) :
dict_t dict = params_to_dict(args);
- if (dict.count("host"))
- host = dict["host"];
+ if (dict.count("rtl_tcp")) {
+ std::vector< std::string > tokens;
+ boost::algorithm::split( tokens, dict["rtl_tcp"], boost::is_any_of(":") );
- if (dict.count("port"))
- port = boost::lexical_cast< unsigned short >( dict["port"] );
+ if ( tokens[0].length() && (tokens.size() == 1 || tokens.size() == 2 ) )
+ host = tokens[0];
+
+ if ( tokens.size() == 2 ) // port given
+ port = boost::lexical_cast< unsigned short >( tokens[1] );
+ }
if (dict.count("psize"))
payload_size = boost::lexical_cast< int >( dict["psize"] );