def __init__(self, port, send_string=None, match_re=None,
                 interval=10, timeout=5, retries=2):
        super(TCP, self).__init__(interval=interval, timeout=timeout,
                                      retries=retries)

        # name to show in generic state export
        self.name = 'tcp'

        ### port ###
        self.port = port
        if not isinstance(port, int) or port < 1 or port > 65535:
            log_msg = ('port "{}" must be an integer between 1 and 65535'.
                       format(port))
            LOG.error(log_msg)
            raise Error(log_msg)

        ### match_re ###
        self.match_re = match_re
        self._match_re_compiled = None
        if self.match_re is not None:
            if not isinstance(match_re, str) \
                    or len(match_re) > MAX_MATCH_RE_LEN:
                log_msg = ('match_re "{}" must be a string, {} chars max'.
                           format(match_re, MAX_MATCH_RE_LEN))
                LOG.error(log_msg)
                raise Error(log_msg)
            
            # compile regexp obj to use for matching
            try:
                self._match_re_compiled = re.compile(self.match_re, flags=re.I)
            except Exception as e:
                log_msg = ('failed to compile a regular '
                           'expression from "{}", {}'
                           .format(self.match_re, e))
                LOG.error(log_msg)
                raise Error(log_msg)

        ### send_string ###
        self.send_string = send_string
        self._send_bytes = None
        if send_string is not None:
            if not isinstance(send_string, str) \
                    or len(send_string) > MAX_SEND_STRING_LEN:
                log_msg = ('send_string "{}" must be a string, {} chars max'.
                       format(send_string, MAX_SEND_STRING_LEN))
                LOG.error(log_msg)
                raise Error(log_msg)

            # convert to bytes for sending over network
            self._send_bytes = self.send_string.encode()
Returns the Partner status.
dataset/ETHPy150Open polaris-gslb/polaris-gslb/polaris_health/monitors/tcp.py/TCP.__init__--crossover with--dataset/ETHPy150Open gijzelaerr/python-snap7/snap7/partner.py/Partner.get_status