Created
July 21, 2019 15:16
-
-
Save HavishNetla/6bc10c75101637c6a45a1ac6c7580226 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 | |
from contextlib import closing | |
HOST = '127.0.0.1' # The server's hostname or IP address | |
PORT = 65432 # The port used by the server | |
with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s: | |
s.connect((HOST, PORT)) | |
s.sendall(b'Hello, world') | |
data = s.recv(1024) | |
print('Received', repr(data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment