Created
June 22, 2020 11:00
-
-
Save ahmedfgad/4f0dbecc683c2281216757c6a16d315e to your computer and use it in GitHub Desktop.
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 | |
| soc = socket.socket() | |
| print("Socket is created.") | |
| soc.bind(("localhost", 10000)) | |
| print("Socket is bound to an address & port number.") | |
| soc.listen(1) | |
| print("Listening for incoming connection ...") | |
| accept_timeout = 5 | |
| soc.settimeout(accept_timeout) | |
| connection, address = soc.accept() | |
| print("Connected to a client: {client_info}.".format(client_info=address)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment