Skip to content

Commit 93399f6

Browse files
author
Bongjun Hur
committed
move out accept() from while, specify 1024 byte
1 parent 456fc8a commit 93399f6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

examples/wiznet5k_simpleserver.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
server.bind((server_ip, server_port)) # Bind to IP and Port
2929
server.listen() # Begin listening for incoming clients
3030

31+
conn, addr = server.accept() # Wait for a connection from a client.
3132
while True:
32-
conn, addr = server.accept() # Wait for a connection from a client.
3333
with conn:
34-
while True:
35-
data = conn.recv()
36-
if data: # Wait for receiving data
37-
print(data)
38-
conn.send(data) # Echo message back to client
34+
data = conn.recv(1024)
35+
if data: # Wait for receiving data
36+
print(data)
37+
conn.send(data) # Echo message back to client

0 commit comments

Comments
 (0)