Added ipv4/ipv6 check
This commit is contained in:
parent
a083a7eeae
commit
2029d53e2a
@ -23,7 +23,13 @@ def main(args):
|
|||||||
startListen(s)
|
startListen(s)
|
||||||
|
|
||||||
def setupSocket(address, port):
|
def setupSocket(address, port):
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
# IPv4/IPv6-check
|
||||||
|
if address == "" or ":" in address:
|
||||||
|
family = socket.AF_INET6
|
||||||
|
else:
|
||||||
|
family = socket.AF_INET
|
||||||
|
|
||||||
|
s = socket.socket(family, socket.SOCK_DGRAM)
|
||||||
s.bind((address, port))
|
s.bind((address, port))
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user