Skip to content

Commit

Permalink
SONOS socket backend error handling #348
Browse files Browse the repository at this point in the history
  • Loading branch information
Rello committed Dec 9, 2018
1 parent cf67b85 commit e7b7dd0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Controller/SonosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,17 @@ public function getDeviceList()
private function discoverDevices()
{
$port = 1900;
$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
try {
//$sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
$sock = socket_create(AF_INET, SOCK_DGRAM, 21);
} catch (\Exception $e) {
$this->logger->error('SONOS discovery not possible; no socket setup on webserver; check Audio Player wiki', array('app' => 'audioplayer'));
return array();
}
if (!$sock) {
$this->logger->error('SONOS discovery not possible; connection issue; check Audio Player wiki', array('app' => 'audioplayer'));
return array();
}
$level = getprotobyname("ip");
socket_set_option($sock, $level, IP_MULTICAST_TTL, 2);
$data = "M-SEARCH * HTTP/1.1\r\n";
Expand Down

0 comments on commit e7b7dd0

Please sign in to comment.