@@ 173-183 (lines=11) @@ | ||
170 | * |
|
171 | * @return PromiseInterface |
|
172 | */ |
|
173 | public function alive(AliveOptions $options) |
|
174 | { |
|
175 | $request = $this->getAliveRequestFactory()->createRequest($options); |
|
176 | $data = trim(RequestSerializer::toString($request)) . "\r\n\r\n"; |
|
177 | ||
178 | $socket = $this->getMulticastFactory()->createSender(); |
|
179 | ||
180 | $socket->send($data, sprintf('%s:%s', self::MULTICAST_ADDRESS, self::MULTICAST_PORT)); |
|
181 | ||
182 | return $this; |
|
183 | } |
|
184 | ||
185 | /** |
|
186 | * Send byebye request |
|
@@ 192-202 (lines=11) @@ | ||
189 | * |
|
190 | * @return PromiseInterface |
|
191 | */ |
|
192 | public function byebye(ByebyeOptions $options) |
|
193 | { |
|
194 | $request = $this->getByebyeRequestFactory()->createRequest($options); |
|
195 | $data = trim(RequestSerializer::toString($request)) . "\r\n\r\n"; |
|
196 | ||
197 | $socket = $this->getMulticastFactory()->createSender(); |
|
198 | ||
199 | $socket->send($data, sprintf('%s:%s', self::MULTICAST_ADDRESS, self::MULTICAST_PORT)); |
|
200 | ||
201 | return $this; |
|
202 | } |
|
203 | ||
204 | /** |
|
205 | * Send discover request |
|
@@ 249-259 (lines=11) @@ | ||
246 | * |
|
247 | * @return PromiseInterface |
|
248 | */ |
|
249 | public function update(UpdateOptions $options) |
|
250 | { |
|
251 | $request = $this->getUpdateRequestFactory()->createRequest($options); |
|
252 | $data = trim(RequestSerializer::toString($request)) . "\r\n\r\n"; |
|
253 | ||
254 | $socket = $this->getMulticastFactory()->createSender(); |
|
255 | ||
256 | $socket->send($data, sprintf('%s:%s', self::MULTICAST_ADDRESS, self::MULTICAST_PORT)); |
|
257 | ||
258 | return $this; |
|
259 | } |
|
260 | ||
261 | /** |
|
262 | * Parse message |