Change connection default address

Change connection default from "localhost" to socket.INADDR_LOOPBACK
localhost could eventually resolve to IPv6 Address.
pigpiod binds itself to INADDR_LOOPBACK given by glibc (always IPv4)
Change behavior of python part to do the same.
This commit is contained in:
Björn Schrader 2018-02-12 14:08:22 +01:00 committed by GitHub
parent 1737d47747
commit b3c5e155eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -5012,7 +5012,7 @@ class pi():
return a.trigger
def __init__(self,
host = os.getenv("PIGPIO_ADDR", 'localhost'),
host = os.getenv("PIGPIO_ADDR", socket.INADDR_LOOPBACK),
port = os.getenv("PIGPIO_PORT", 8888)):
"""
Grants access to a Pi's GPIO.
@ -5051,7 +5051,7 @@ class pi():
port = int(port)
if host == '':
host = "localhost"
host = socket.INADDR_LOOPBACK
self._host = host
self._port = port