-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient.py
More file actions
25 lines (21 loc) · 695 Bytes
/
client.py
File metadata and controls
25 lines (21 loc) · 695 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
#!/usr/bin/python # This is client.py file
import socket # Import socket module
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 12345 # Reserve a port for your service.
s.connect((host, port))
##print(s.recv(1024))
while True:
data = s.recv(1024)
if data == 'q' or data=='Q':
s.close()
break;
else:
print("RECIEVED:" , data)
data = input( "SEND( TYPE q or Q to Quit):")
if data == 'Q' and data == 'q':
s.send(bytes(data,'UTF-8'))
s.close()
break
else:
s.send(bytes(data,'UTF-8'))