summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Roversi <diegor@tiscali.it>2019-09-15 16:21:58 +0200
committerDiego Roversi <diegor@tiscali.it>2019-09-15 16:21:58 +0200
commitbfc996aafb95832a816c2342df5029d099eee2ad (patch)
tree5e0f1b2a503e8277524b961b868b3e424e17b2e2
parentfbf3c57576fcc20381b2cba4c8b483ef0b958107 (diff)
convert some string into bytes
-rw-r--r--common/hostchooser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/hostchooser.py b/common/hostchooser.py
index 7dea833..bbb0eb6 100644
--- a/common/hostchooser.py
+++ b/common/hostchooser.py
@@ -32,7 +32,7 @@ def answer_ping(s, descr, addr, extra='', httpport=''):
print("ping by", source, file=sys.stderr)
answer = '%s:%s:%s:%s:%s:%s' % (PONG_MESSAGE, descr,
addr[0], addr[1], extra, httpport)
- s.sendto(answer, source)
+ s.sendto(answer.encode(), source)
else:
print("unexpected data on UDP port %d by" % UDP_PORT, source, file=sys.stderr)
@@ -116,7 +116,7 @@ def find_servers(hostlist=[('127.0.0.1', None), ('<broadcast>', None)],
else:
hostsend, hostrecv = events.setdefault(ipaddr, ([], []))
hostrecv.append(time.time())
- data = data.split(':')
+ data = data.split(b':')
if len(data) >= 4 and data[0] == PONG_MESSAGE:
try:
port = int(data[3])