Skip to content

Commit

Permalink
Merge pull request #347 from tarasfrompir/master
Browse files Browse the repository at this point in the history
Update ssdp_finder.class.php
  • Loading branch information
T-REX-XP committed Oct 29, 2018
2 parents 64c6c19 + 1202624 commit 5322c58
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/ssdp_finder/ssdp_finder.class.php
Expand Up @@ -249,10 +249,17 @@ function update_methods(&$out) {
* @access public
*/
function getLocalIp() {
return gethostbyname(trim(`hostname`));
$s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_connect($s ,'8.8.8.8', 53); // connecting to a UDP address doesn't send packets
socket_getsockname($s, $local_ip_address, $port);
@socket_shutdown($s, 2);
socket_close($s);

return $local_ip_address;
}



/**
* ssdp_devices edit/add
*
Expand Down

0 comments on commit 5322c58

Please sign in to comment.