Skip to content

Instantly share code, notes, and snippets.

@sznurek
Created July 26, 2012 14:47
Show Gist options
  • Save sznurek/3182477 to your computer and use it in GitHub Desktop.
Save sznurek/3182477 to your computer and use it in GitHub Desktop.
First try
# methods on_read and on_write was called when select confirmed that socket is ready to read from / write to
STATE_SEND_LOGIN = 1
STATE_RECEIVE_LOGIN = 2
STATE_SEND_PASS = 3
STATE_RECEIVE_PASS = 4
STATE_SEND_OK = 5
class Authenticator:
def __init__(self, sock):
self.sock = sock
self.state = STATE_SEND_LOGIN
def on_read(self):
if self.state == ...
def on_write(self):
if self.state == ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment