Created
August 18, 2020 22:52
-
-
Save leeyoungseok/6fe36892735057296f1746b1398cc28e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket, ssl, pprint | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
ssock = ssl.wrap_socket(s, | |
ca_certs="server.crt", cert_reqs = ssl.CERT_REQUIRED) | |
ssock.connect(('localhost', 12345)) | |
print(repr(ssock.getpeername())) | |
print(ssock.cipher()) | |
print(pprint.pformat(ssock.getpeername())) | |
msg = input('Type the message: ') | |
msg = msg.encode('utf-8') | |
ssock.sendall(msg) | |
data = ssock.recv(1500) | |
print('Echoed {0}'.format(data.decode('utf-8'))) | |
ssock.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment