| 106 | } |
| 107 | |
| 108 | int |
| 109 | InfoRepoMulticastResponder::common_init( |
| 110 | CORBA::ORB_ptr orb) |
| 111 | { |
| 112 | orb_ = CORBA::ORB::_duplicate(orb); |
| 113 | |
| 114 | if (this->response_addr_.set((u_short) 0) == -1) |
| 115 | ACE_ERROR_RETURN((LM_ERROR, |
| 116 | "InfoRepoMulticastResponder::common_init() %p\n", |
| 117 | ACE_TEXT("set")), |
| 118 | -1); |
| 119 | |
| 120 | else if (this->response_.open(this->response_addr_) == -1) { |
| 121 | ACE_ERROR_RETURN((LM_ERROR, |
| 122 | "%p\n", |
| 123 | ACE_TEXT("set")), |
| 124 | -1); |
| 125 | } |
| 126 | |
| 127 | // Use ACE_SOCK_Dgram_Mcast factory to subscribe to multicast group. |
| 128 | #ifdef ACE_HAS_MAC_OSX |
| 129 | mcast_dgram_.opts(ACE_SOCK_Dgram_Mcast::OPT_BINDADDR_NO | |
| 130 | ACE_SOCK_Dgram_Mcast::DEFOPT_NULLIFACE); |
| 131 | #endif |
| 132 | if (this->mcast_nic_.length() != 0) { |
| 133 | if (this->mcast_dgram_.join(this->mcast_addr_, |
| 134 | 1, |
| 135 | ACE_TEXT_CHAR_TO_TCHAR(this->mcast_nic_.c_str())) == -1) |
| 136 | ACE_ERROR_RETURN((LM_ERROR, "InfoRepoMulticastResponder::common_init() %p\n", |
| 137 | ACE_TEXT("subscribe")), -1); |
| 138 | |
| 139 | } else { |
| 140 | if (this->mcast_dgram_.join(this->mcast_addr_) == -1) |
| 141 | ACE_ERROR_RETURN((LM_ERROR, |
| 142 | "InfoRepoMulticastResponder::common_init() %p\n", |
| 143 | ACE_TEXT("subscribe")), |
| 144 | -1); |
| 145 | } |
| 146 | |
| 147 | this->initialized_ = true; |
| 148 | return 0; |
| 149 | } |
| 150 | |
| 151 | int |
| 152 | InfoRepoMulticastResponder::handle_timeout(const ACE_Time_Value &, |