-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.py
More file actions
28 lines (22 loc) · 639 Bytes
/
client.py
File metadata and controls
28 lines (22 loc) · 639 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import socket
import time
def main():
host = '127.0.0.1'
port = 4404
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect((host, port))
try:
while True:
# Receive data from the server
data = client_socket.recv(1024)
if not data:
break
print("Received:", data.decode('utf-8'))
# Simulate processing time
time.sleep(1)
except Exception as e:
print(f"Error: {e}")
finally:
client_socket.close()
if __name__ == "__main__":
main()