def add(self, x, y): self.QNO += 1 qno = self.QNO client_ip = get_request_data().client_address[0] print 'Got question %d from %s...' % (qno, client_ip) sleep(5) print 'Finished question %d from %s' % (qno, client_ip) return '%s: %d + %d = %d' % (client_ip, x, y, x+y)
def signIn(self, msg): try: platform_info = decode(msg) client_ip = get_request_data().client_address[0] logger.debug(client_ip) sign_in_handler(client_ip, platform_info) return 1 except Exception, e: logger.exception("") return 0
def echo(msg=""): print 'A message from %s:\n%s' % (get_request_data().client_address, msg) return msg