{
    "mode": "pydoc",
    "parameter": "asynchat",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/asynchat/json",
    "generated": "2026-06-02T13:25:18Z",
    "sections": {
        "NAME": {
            "content": "asynchat - A class supporting chat-style (command/response) protocols.\n",
            "subsections": []
        },
        "MODULE REFERENCE": {
            "content": "https://docs.python.org/3.10/library/asynchat.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This class adds support for 'chat' style protocols - where one side\nsends a 'command', and the other sends a response (examples would be\nthe common internet protocols - smtp, nntp, ftp, etc..).\n\nThe handleread() method looks at the input stream for the current\n'terminator' (usually '\\r\\n' for single-line responses, '\\r\\n.\\r\\n'\nfor multi-line output), calling self.foundterminator() on its\nreceipt.\n\nfor example:\nSay you build an async nntp client using this class.  At the start\nof the connection, you'll have self.terminator set to '\\r\\n', in\norder to process the single-line greeting.  Just before issuing a\n'LIST' command you'll set it to '\\r\\n.\\r\\n'.  The output of the LIST\ncommand will be accumulated (using your own 'collectincomingdata'\nmethod) up to the terminator, and then control will be returned to\nyou - by calling your self.foundterminator() method.\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "asyncore.dispatcher(builtins.object)\nasyncchat\nbuiltins.object\nsimpleproducer\n",
            "subsections": [
                {
                    "name": "class async_chat",
                    "content": "|  asyncchat(sock=None, map=None)\n|\n|  This is an abstract class.  You must derive from this class, and add\n|  the two methods collectincomingdata() and foundterminator()\n|\n|  Method resolution order:\n|      asyncchat\n|      asyncore.dispatcher\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, sock=None, map=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  closewhendone(self)\n|      automatically close this channel once the outgoing queue is empty\n|\n|  collectincomingdata(self, data)\n|\n|  discardbuffers(self)\n|\n|  foundterminator(self)\n|\n|  getterminator(self)\n|\n|  handleclose(self)\n|\n|  handleread(self)\n|\n|  handlewrite(self)\n|\n|  initiatesend(self)\n|\n|  push(self, data)\n|\n|  pushwithproducer(self, producer)\n|\n|  readable(self)\n|      predicate for inclusion in the readable for select()\n|\n|  setterminator(self, term)\n|      Set the input delimiter.\n|\n|      Can be a fixed string of any length, an integer, or None.\n|\n|  writable(self)\n|      predicate for inclusion in the writable for select()\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\n|\n|  acinbuffersize = 65536\n|\n|  acoutbuffersize = 65536\n|\n|  encoding = 'latin-1'\n|\n|  useencoding = 0\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from asyncore.dispatcher:\n|\n|  repr(self)\n|      Return repr(self).\n|\n|  accept(self)\n|\n|  addchannel(self, map=None)\n|\n|  bind(self, addr)\n|\n|  close(self)\n|\n|  connect(self, address)\n|\n|  createsocket(self, family=<AddressFamily.AFINET: 2>, type=<SocketKind.SOCKSTREAM: 1>)\n|\n|  delchannel(self, map=None)\n|\n|  handleaccept(self)\n|\n|  handleaccepted(self, sock, addr)\n|\n|  handleconnect(self)\n|\n|  handleconnectevent(self)\n|\n|  handleerror(self)\n|\n|  handleexpt(self)\n|\n|  handleexptevent(self)\n|\n|  handlereadevent(self)\n|\n|  handlewriteevent(self)\n|\n|  listen(self, num)\n|\n|  log(self, message)\n|\n|  loginfo(self, message, type='info')\n|\n|  recv(self, buffersize)\n|\n|  send(self, data)\n|\n|  setreuseaddr(self)\n|\n|  setsocket(self, sock, map=None)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from asyncore.dispatcher:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Data and other attributes inherited from asyncore.dispatcher:\n|\n|  accepting = False\n|\n|  addr = None\n|\n|  closing = False\n|\n|  connected = False\n|\n|  connecting = False\n|\n|  debug = False\n|\n|  ignorelogtypes = frozenset({'warning'})\n"
                },
                {
                    "name": "class simple_producer",
                    "content": "|  simpleproducer(data, buffersize=512)\n|\n|  Methods defined here:\n|\n|  init(self, data, buffersize=512)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  more(self)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors defined here:\n|\n|  dict\n|      dictionary for instance variables (if defined)\n|\n|  weakref\n|      list of weak references to the object (if defined)\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "find_prefix_at_end",
                    "content": ""
                },
                {
                    "name": "warn",
                    "content": "Issue a warning, or maybe ignore it or raise an exception.\n"
                }
            ]
        },
        "DATA": {
            "content": "warningregistry = {'version': 0}\n",
            "subsections": []
        },
        "FILE": {
            "content": "/usr/lib/python3.10/asynchat.py\n\n",
            "subsections": []
        }
    },
    "summary": "asynchat - A class supporting chat-style (command/response) protocols.",
    "flags": [],
    "examples": [],
    "see_also": []
}