class_docstr: server protocol. Methods from classes that subclass Server can be called
  transparently from a client
class_docstr_tok: ["server","protocol",".","Methods","from","classes","that","subclass","Server","can","be","called","transparently","from","a","client"]
docstr: Executes a single function with associated I/O.
  Protocol:
  - the arguments and results are serialized with the pickle protocol
  - client sends : (fname,args)
      fname = method name to call
      args = tuple of arguments
  - server sends result: (rid,st,ret)
      rid = request id
      st = None, or exception if there was during execution
      ret = return value or None if st!=None
docstr_tok: ["Executes","a","single","function","with","associated","I\/O",".","Protocol",":","-","the","arguments","and","results","are","serialized","with","the","pickle","protocol","-","client","sends",":","(","fname",",","args",")","fname","=","method","name","to","call","args","=","tuple","of","arguments","-","server","sends","result",":","(","rid",",","st",",","ret",")","rid","=","request","id","st","=","None",",","or","exception","if","there","was","during","execution","ret","=","return","value","or","None","if","st","!","=None"]
code: def one_function(self):
      """
      Executes a single function with associated I/O.
      Protocol:
      - the arguments and results are serialized with the pickle protocol
      - client sends : (fname,args)
          fname = method name to call
          args = tuple of arguments
      - server sends result: (rid,st,ret)
          rid = request id
          st = None, or exception if there was during execution
          ret = return value or None if st!=None
      """
  
      try:
          (fname, args) = pickle.load(self.fs)
      except EOFError:
          raise ClientExit("read args")
      self.log("executing method %s" % (fname))
      st = None
      ret = None
      try:
          f = getattr(self, fname)
      except AttributeError:
          st = AttributeError("unknown method " + fname)
          self.log("unknown method")
  
      try:
          ret = f(*args)
      except Exception as e:
          # due to a bug (in mod_python?), ServerException cannot be
          # unpickled, so send the string and make the exception on the client side
  
          # st=ServerException(
          #  "".join(traceback.format_tb(sys.exc_info()[2]))+
          #  str(e))
          st = "".join(traceback.format_tb(sys.exc_info()[2])) + str(e)
          self.log("exception in method")
          traceback.print_exc(50, self.logf)
          self.logf.flush()
  
      LOG.info("return")
      try:
          pickle.dump((st, ret), self.fs, protocol=4)
      except EOFError:
          raise ClientExit("function return")
  
imports: import os
  import pickle
  import sys
  import _thread
  import traceback
  import socket
  import logging
label_desc: Use image node_id 3 for calling the Server obj's underlying member method code with example usage: obj.one_function() without return types