Changeset 4896 for source/ariba/utility
- Timestamp:
- Jul 14, 2009, 11:03:23 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/utility/bootstrap/modules/periodicbroadcast/PeriodicBroadcast.h
r4872 r4896 136 136 PeriodicBroadcast::serverport_v6); 137 137 138 socket_v4.open( listen_endpoint_v4.protocol() ); 139 socket_v6.open( listen_endpoint_v6.protocol() ); 140 141 socket_v4.set_option( boost::asio::ip::udp::socket::reuse_address(true) ); 142 socket_v6.set_option( boost::asio::ip::udp::socket::reuse_address(true) ); 143 144 socket_v4.set_option( boost::asio::socket_base::broadcast(true) ); 145 socket_v6.set_option( boost::asio::socket_base::broadcast(true) ); 146 147 socket_v4.bind( listen_endpoint_v4 ); 138 boost::system::error_code err; 139 140 err = socket_v4.open( listen_endpoint_v4.protocol(), err ); 141 if(err) logging_warn("failed opening ipv4 socket"); 142 143 err = socket_v6.open( listen_endpoint_v6.protocol(), err ); 144 if(err) logging_warn("failed opening ipv6 socket"); 145 146 err = socket_v4.set_option( boost::asio::ip::udp::socket::reuse_address(true), err ); 147 if(err) logging_warn("failed setting reuse address option on ipv4 socket"); 148 149 err = socket_v6.set_option( boost::asio::ip::udp::socket::reuse_address(true), err ); 150 if(err) logging_warn("failed setting reuse address option on ipv6 socket"); 151 152 err = socket_v4.set_option( boost::asio::socket_base::broadcast(true), err ); 153 if(err) logging_warn("failed setting broadcast option on ipv4 socket"); 154 155 err = socket_v6.set_option( boost::asio::socket_base::broadcast(true), err ); 156 if(err) logging_warn("failed setting broadcast option on ipv6 socket"); 157 158 err = socket_v4.bind( listen_endpoint_v4, err ); 159 if(err) logging_warn("failed binding ipv4 socket"); 160 148 161 //socket_v6.bind( listen_endpoint_v6 ); 149 162 … … 160 173 161 174 cout << "-----------> sending out " << data << std::endl; 175 boost::system::error_code err; 162 176 163 177 { 164 178 udp::endpoint endp(udp::v4(), PeriodicBroadcast::serverport_v4); 165 179 endp.address( boost::asio::ip::address_v4::broadcast() ); 166 socket_v4.send_to( boost::asio::buffer(pnt, len), endp, 0, ignored_error ); 180 socket_v4.send_to( boost::asio::buffer(pnt, len), endp, 0, err ); 181 if(err) logging_warn("failed sending message through ipv4 socket"); 167 182 } 168 { 183 {/* 169 184 udp::endpoint endp(udp::v6(), PeriodicBroadcast::serverport_v6); 170 185 endp.address( boost::asio::ip::address_v6::from_string("ff02::1") ); 171 186 socket_v6.send_to( boost::asio::buffer(pnt, len), endp, 0, ignored_error ); 172 }187 */} 173 188 } 174 189 … … 214 229 215 230 start_receive(); 231 } else { 232 233 logging_warn("failed receiving message on ipv4 socket" << error); 234 216 235 } 217 236 } 218 237 219 238 void handle_send(boost::shared_ptr<std::string> /*message*/, 220 const boost::system::error_code& /*error*/,239 const boost::system::error_code& error, 221 240 std::size_t /*bytes_transferred*/){ 241 242 if(error) 243 logging_warn("failed sending out message"); 244 222 245 } 223 246
Note:
See TracChangeset
for help on using the changeset viewer.