Last active
March 15, 2021 07:43
-
-
Save studiawan/6710511 to your computer and use it in GitHub Desktop.
Simple client sends string to server
This file contains hidden or 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 | |
# create socket and connect to server | |
server_address = ('localhost', 5000) | |
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
client_socket.connect(server_address) | |
# send string to server and close socket | |
client_socket.send(b'Hi ... ') | |
client_socket.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment