fix UDP server
This commit is contained in:
parent
4699de1dd9
commit
efd45ddfc6
1 changed files with 3 additions and 3 deletions
|
@ -105,14 +105,14 @@ def pack_addr(address):
|
||||||
try:
|
try:
|
||||||
r = socket.inet_pton(family, address)
|
r = socket.inet_pton(family, address)
|
||||||
if family == socket.AF_INET6:
|
if family == socket.AF_INET6:
|
||||||
return '\x04' + r
|
return b'\x04' + r
|
||||||
else:
|
else:
|
||||||
return '\x01' + r
|
return b'\x01' + r
|
||||||
except (TypeError, ValueError, OSError, IOError):
|
except (TypeError, ValueError, OSError, IOError):
|
||||||
pass
|
pass
|
||||||
if len(address) > 255:
|
if len(address) > 255:
|
||||||
address = address[:255] # TODO
|
address = address[:255] # TODO
|
||||||
return '\x03' + chr(len(address)) + address
|
return b'\x03' + chr(len(address)) + address
|
||||||
|
|
||||||
|
|
||||||
def parse_header(data):
|
def parse_header(data):
|
||||||
|
|
Loading…
Add table
Reference in a new issue