Skip to content

Commit 8234fa2

Browse files
committed
edit zip not
1 parent 52384bf commit 8234fa2

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import socket
2+
3+
HOST = '127.0.0.1'
4+
PORT = 65432
5+
6+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
7+
s.connect((HOST, PORT))
8+
s.sendall(b'Hello, world')
9+
data = s.recv(1024)
10+
print('Received', repr(data))

server.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import socket
2+
3+
HOST = '127.0.0.1'
4+
PORT = 65432
5+
6+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
7+
s.bind((HOST, PORT))
8+
s.listen()
9+
conn, addr = s.accept()
10+
with conn:
11+
print('Connected by', addr)
12+
while True:
13+
data = conn.recv(1024)
14+
if not data:
15+
break
16+
conn.sendall(data)

socket python.zip

-883 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)