-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
31 lines (26 loc) · 699 Bytes
/
Copy pathclient.py
File metadata and controls
31 lines (26 loc) · 699 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
29
30
31
# import socket
#
# c = socket.socket()
#
# c.connect(('localhost',10766))
# name = input("Enter your name: ")
# c.send(bytes(name,'utf-8'))
#
# print(c.recv(1024).decode())
# c.close()
import socket
import json
ip = 'localhost'
port = 55556
c = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
print("client socket created")
c.connect(( ip , port))
username = input("enter username: ")
password = input("enter password: ")
username_password = {'username': username , 'password': password}
username_passwords = json.dumps(username_password)
c.send(bytes(username_passwords,'utf-8'))
# password = input("enter password: ")
# c.send(bytes(password,'utf-8'))
print(c.recv(1024).decode())
c.close()