Code that Jim showed in his office.
# server terminal :
softmaple:Desktop mahoney$ python server.py
sever: listening on 127.0.0.1:12468.
server: waiting for connection ...
server: connection from ('127.0.0.1', 58592):<socket.socket fd=4, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 12468), raddr=('127.0.0.1', 58592)>
server: waiting for connection ...
sgg got : 'b'Hi!\r\n''
sgg got : 'b'Are you there???\r\n''
sgg got : 'b"What's up?\r\n"'
And in another terminal window
# client terminal
Last login: Thu Apr 19 09:02:06 on ttys000
softmaple:~ mahoney$ telnet 127.0.0.1 12468
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
sgg: says 0
Hello!
sgg: says 1
Move over there!
sgg: says 2
Connection closed by foreign host.
softmaple:~ mahoney$
last modified | size | ||
server.py | Sat Dec 21 2024 06:06 pm | 1.6K | |
sgg.py | Sat Dec 21 2024 06:06 pm | 288B | |
thread_demo.py | Sat Dec 21 2024 06:06 pm | 1.1K | |
tictactoe.py | Sat Dec 21 2024 06:06 pm | 15K |