{
    "content": [
        {
            "type": "text",
            "text": "# asyncore (pydoc)\n\n**Summary:** asyncore - Basic infrastructure for asynchronous socket service clients and servers.\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **DESCRIPTION** (18 lines)\n- **CLASSES** (8 lines) — 5 subsections\n  - class ExitNow (67 lines)\n  - class dispatcher (92 lines)\n  - class dispatcher_with_send (102 lines)\n  - class file_dispatcher (102 lines)\n  - class file_wrapper (32 lines)\n- **FUNCTIONS** (1 lines) — 8 subsections\n  - close_all (1 lines)\n  - compact_traceback (1 lines)\n  - loop (1 lines)\n  - poll (1 lines)\n  - poll2 (2 lines)\n  - read (1 lines)\n  - readwrite (1 lines)\n  - write (1 lines)\n- **DATA** (15 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nasyncore - Basic infrastructure for asynchronous socket service clients and servers.\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/asyncore.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\n### DESCRIPTION\n\nThere are only two ways to have a program on a single processor do \"more\nthan one thing at a time\".  Multi-threaded programming is the simplest and\nmost popular way to do it, but there is another very different technique,\nthat lets you have nearly all the advantages of multi-threading, without\nactually using multiple threads. it's really only practical if your program\nis largely I/O bound. If your program is CPU bound, then pre-emptive\nscheduled threads are probably what you really need. Network servers are\nrarely CPU-bound, however.\n\nIf your operating system supports the select() system call in its I/O\nlibrary (and nearly all do), then you can use it to juggle multiple\ncommunication channels at once; doing other work while your I/O is taking\nplace in the \"background.\"  Although this strategy can seem strange and\ncomplex, especially at first, it is in many ways easier to understand and\ncontrol than multi-threaded programming. The module documented here solves\nmany of the difficult problems for you, making the task of building\nsophisticated high-performance network servers and clients a snap.\n\n### CLASSES\n\nbuiltins.Exception(builtins.BaseException)\nExitNow\nbuiltins.object\ndispatcher\ndispatcherwithsend\nfiledispatcher\nfilewrapper\n\n#### class ExitNow\n\n|  Method resolution order:\n|      ExitNow\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.Exception:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.Exception:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n\n#### class dispatcher\n\n|  dispatcher(sock=None, map=None)\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|  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|  handleclose(self)\n|\n|  handleconnect(self)\n|\n|  handleconnectevent(self)\n|\n|  handleerror(self)\n|\n|  handleexpt(self)\n|\n|  handleexptevent(self)\n|\n|  handleread(self)\n|\n|  handlereadevent(self)\n|\n|  handlewrite(self)\n|\n|  handlewriteevent(self)\n|\n|  listen(self, num)\n|\n|  log(self, message)\n|\n|  loginfo(self, message, type='info')\n|\n|  readable(self)\n|\n|  recv(self, buffersize)\n|\n|  send(self, data)\n|\n|  setreuseaddr(self)\n|\n|  setsocket(self, sock, map=None)\n|\n|  writable(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|\n|  ----------------------------------------------------------------------\n|  Data and other attributes defined here:\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\n#### class dispatcher_with_send\n\n|  dispatcherwithsend(sock=None, map=None)\n|\n|  Method resolution order:\n|      dispatcherwithsend\n|      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|  handlewrite(self)\n|\n|  initiatesend(self)\n|\n|  send(self, data)\n|\n|  writable(self)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from 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|  handleclose(self)\n|\n|  handleconnect(self)\n|\n|  handleconnectevent(self)\n|\n|  handleerror(self)\n|\n|  handleexpt(self)\n|\n|  handleexptevent(self)\n|\n|  handleread(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|  readable(self)\n|\n|  recv(self, buffersize)\n|\n|  setreuseaddr(self)\n|\n|  setsocket(self, sock, map=None)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from 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 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\n#### class file_dispatcher\n\n|  filedispatcher(fd, map=None)\n|\n|  Method resolution order:\n|      filedispatcher\n|      dispatcher\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  init(self, fd, map=None)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  setfile(self, fd)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from 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|  handleclose(self)\n|\n|  handleconnect(self)\n|\n|  handleconnectevent(self)\n|\n|  handleerror(self)\n|\n|  handleexpt(self)\n|\n|  handleexptevent(self)\n|\n|  handleread(self)\n|\n|  handlereadevent(self)\n|\n|  handlewrite(self)\n|\n|  handlewriteevent(self)\n|\n|  listen(self, num)\n|\n|  log(self, message)\n|\n|  loginfo(self, message, type='info')\n|\n|  readable(self)\n|\n|  recv(self, buffersize)\n|\n|  send(self, data)\n|\n|  setreuseaddr(self)\n|\n|  setsocket(self, sock, map=None)\n|\n|  writable(self)\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from 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 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\n#### class file_wrapper\n\n|  filewrapper(fd)\n|\n|  Methods defined here:\n|\n|  del(self)\n|\n|  init(self, fd)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  close(self)\n|\n|  fileno(self)\n|\n|  getsockopt(self, level, optname, buflen=None)\n|\n|  read = recv(self, *args)\n|\n|  recv(self, *args)\n|\n|  send(self, *args)\n|\n|  write = send(self, *args)\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\n### FUNCTIONS\n\n#### close_all\n\n#### compact_traceback\n\n#### loop\n\n#### poll\n\n#### poll2\n\npoll3 = poll2(timeout=0.0, map=None)\n\n#### read\n\n#### readwrite\n\n#### write\n\n### DATA\n\nEAGAIN = 11\nEALREADY = 114\nEBADF = 9\nECONNABORTED = 103\nECONNRESET = 104\nEINPROGRESS = 115\nEINVAL = 22\nEISCONN = 106\nENOTCONN = 107\nEPIPE = 32\nESHUTDOWN = 108\nEWOULDBLOCK = 11\nerrorcode = {1: 'EPERM', 2: 'ENOENT', 3: 'ESRCH', 4: 'EINTR', 5: 'EIO'...\nsocketmap = {}\n\n### FILE\n\n/usr/lib/python3.10/asyncore.py\n\n"
        }
    ],
    "structuredContent": {
        "command": "asyncore",
        "section": "",
        "mode": "pydoc",
        "summary": "asyncore - Basic infrastructure for asynchronous socket service clients and servers.",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 8,
                "subsections": [
                    {
                        "name": "class ExitNow",
                        "lines": 67
                    },
                    {
                        "name": "class dispatcher",
                        "lines": 92
                    },
                    {
                        "name": "class dispatcher_with_send",
                        "lines": 102
                    },
                    {
                        "name": "class file_dispatcher",
                        "lines": 102
                    },
                    {
                        "name": "class file_wrapper",
                        "lines": 32
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "close_all",
                        "lines": 1
                    },
                    {
                        "name": "compact_traceback",
                        "lines": 1
                    },
                    {
                        "name": "loop",
                        "lines": 1
                    },
                    {
                        "name": "poll",
                        "lines": 1
                    },
                    {
                        "name": "poll2",
                        "lines": 2
                    },
                    {
                        "name": "read",
                        "lines": 1
                    },
                    {
                        "name": "readwrite",
                        "lines": 1
                    },
                    {
                        "name": "write",
                        "lines": 1
                    }
                ]
            },
            {
                "name": "DATA",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}