class_docstr: Implementation of TensorBoardServer using the Werkzeug dev server.
class_docstr_tok: ["Implementation","of","TensorBoardServer","using","the","Werkzeug","dev","server","."]
docstr: Override to set custom options on the socket.
docstr_tok: ["Override","to","set","custom","options","on","the","socket","."]
code: def server_bind(self):
      """Override to set custom options on the socket."""
      if self._flags.reuse_port:
          try:
              socket.SO_REUSEPORT
          except AttributeError:
              raise TensorBoardServerException(
                  "TensorBoard --reuse_port option is not supported on this platform"
              )
          self.socket.setsockopt(
              socket.SOL_SOCKET, socket.SO_REUSEPORT, 1
          )
  
      # Enable IPV4 mapping for IPV6 sockets when desired.
      # The main use case for this is so that when no host is specified,
      # TensorBoard can listen on all interfaces for both IPv4 and IPv6
      # connections, rather than having to choose v4 or v6 and hope the
      # browser didn't choose the other one.
      socket_is_v6 = (
          hasattr(socket, "AF_INET6")
          and self.socket.family == socket.AF_INET6
      )
      has_v6only_option = hasattr(socket, "IPPROTO_IPV6") and hasattr(
          socket, "IPV6_V6ONLY"
      )
      if self._auto_wildcard and socket_is_v6 and has_v6only_option:
          try:
              self.socket.setsockopt(
                  socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 0
              )
          except socket.error as e:
              # Log a warning on failure to dual-bind, except for EAFNOSUPPORT
              # since that's expected if IPv4 isn't supported at all (IPv6-only).
              if (
                  hasattr(errno, "EAFNOSUPPORT")
                  and e.errno != errno.EAFNOSUPPORT
              ):
                  logger.warning(
                      "Failed to dual-bind to IPv4 wildcard: %s", str(e)
                  )
      super().server_bind()
  
imports: from abc import ABCMeta
  from abc import abstractmethod
  import argparse
  import atexit
  from collections import defaultdict
  import errno
  import logging
  import mimetypes
  import os
  import shlex
  import signal
  import socket
  import sys
  import threading
  import time
  import urllib.parse
  from absl import flags
  from absl.flags import argparse_flags
  from werkzeug import serving
  from tensorboard import manager
  from tensorboard import version
  from tensorboard.backend import application
  from tensorboard.backend.event_processing import data_ingester
  from tensorboard.backend.event_processing import event_file_inspector
  from tensorboard.data import server_ingester
  from tensorboard.plugins.core import core_plugin
  from tensorboard.util import tb_logging
label_desc: Use image node_id 3 for calling the WerkzeugServer obj's underlying member method code with example usage: obj.server_bind() without return types