Created
June 25, 2017 02:59
-
-
Save cwyark/8f57bf58da8d400dffd5914b5ddc3bfd 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 usocket as socket | |
telnet_server_fd = socket.socket() | |
telnet_server_fd.bind(("0.0.0.0", 23)) | |
telnet_server_fd.listen(2) | |
telnet_client_fd = None | |
def setup_telnet(s): | |
global telnet_client_fd | |
telnet_client_fd, addr = telnet_server_fd.accept() | |
uterminal.register(telnet_client_fd) | |
telnet_client_fd.setblocking(False) | |
print("here's comes a telnet client {}".format(addr)) | |
telnet_server_fd.setsockopt(socket.SOL_SOCKET, 20, setup_telnet) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment