Created
August 11, 2019 14:21
-
-
Save madwayz/82de42d1d09dd798844c764bfecabe0d to your computer and use it in GitHub Desktop.
Socket сервер
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 | |
| ADDRESS = '127.0.0.1' | |
| PORT = 7777 | |
| with socket.socket() as s: | |
| s.bind((ADDRESS, PORT)) | |
| s.listen(1) | |
| connectionObject, address = s.accept() | |
| connectionObject.sendall(b'Hello, World!') | |
| while True: | |
| with connectionObject: | |
| data = connectionObject.recv(1024) | |
| print(data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment