diff options
Diffstat (limited to 'Demo/sockets')
-rwxr-xr-x | Demo/sockets/udpecho.py | 3 | ||||
-rw-r--r-- | Demo/sockets/unixclient.py | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Demo/sockets/udpecho.py b/Demo/sockets/udpecho.py index 8a6bd21..9966fd8 100755 --- a/Demo/sockets/udpecho.py +++ b/Demo/sockets/udpecho.py @@ -56,7 +56,8 @@ def client(): line = sys.stdin.readline() if not line: break - s.sendto(line, addr) + print('addr = ', addr) + s.sendto(bytes(line, 'ascii'), addr) data, fromaddr = s.recvfrom(BUFSIZE) print('client received %r from %r' % (data, fromaddr)) diff --git a/Demo/sockets/unixclient.py b/Demo/sockets/unixclient.py index cdccb84..5e87eed 100644 --- a/Demo/sockets/unixclient.py +++ b/Demo/sockets/unixclient.py @@ -6,7 +6,7 @@ from socket import * FILE = 'unix-socket' s = socket(AF_UNIX, SOCK_STREAM) s.connect(FILE) -s.send('Hello, world') +s.send(b'Hello, world') data = s.recv(1024) s.close() print('Received', repr(data)) |