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 | Sun Dec 22 2024 05:00 am | 1.6K | |
sgg.py | Sun Dec 22 2024 05:00 am | 288B | |
thread_demo.py | Sun Dec 22 2024 05:00 am | 1.1K | |
tictactoe.py | Sun Dec 22 2024 05:00 am | 15K |