From dbc65d928362b983d8f6113319db87841a5b159d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Fri, 4 Jun 2010 12:00:23 -0700 Subject: recv discovery packets with max size buffer (we dont know what to expect) --- host/lib/usrp/usrp2/usrp2_impl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp') diff --git a/host/lib/usrp/usrp2/usrp2_impl.cpp b/host/lib/usrp/usrp2/usrp2_impl.cpp index af3ec216a..1e6e02dd1 100644 --- a/host/lib/usrp/usrp2/usrp2_impl.cpp +++ b/host/lib/usrp/usrp2/usrp2_impl.cpp @@ -76,16 +76,17 @@ uhd::device_addrs_t usrp2::find(const device_addr_t &hint){ udp_transport->send(boost::asio::buffer(&ctrl_data_out, sizeof(ctrl_data_out))); //loop and recieve until the timeout + boost::uint8_t usrp2_ctrl_data_in_mem[1500]; //allocate MTU bytes for recv + usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast(usrp2_ctrl_data_in_mem); while(true){ - usrp2_ctrl_data_t ctrl_data_in; - size_t len = udp_transport->recv(asio::buffer(&ctrl_data_in, sizeof(ctrl_data_in))); + size_t len = udp_transport->recv(asio::buffer(usrp2_ctrl_data_in_mem)); //std::cout << len << "\n"; if (len >= sizeof(usrp2_ctrl_data_t)){ //handle the received data - switch(ntohl(ctrl_data_in.id)){ + switch(ntohl(ctrl_data_in->id)){ case USRP2_CTRL_ID_WAZZUP_DUDE: //make a boost asio ipv4 with the raw addr in host byte order - boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in.data.ip_addr)); + boost::asio::ip::address_v4 ip_addr(ntohl(ctrl_data_in->data.ip_addr)); device_addr_t new_addr; new_addr["name"] = "USRP2"; new_addr["addr"] = ip_addr.to_string(); -- cgit v1.2.3