How to use the mcstatus.protocol.connection.Connection.__init__ function in mcstatus

To help you get started, we’ve selected a few mcstatus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Dinnerbone / mcstatus / mcstatus / protocol / connection.py View on Github external
def __init__(self, addr, timeout=3):
        Connection.__init__(self)
        self.addr = addr
        self.socket = socket.socket(socket.AF_INET if ip_type(addr[0]) == 4 else socket.AF_INET6, socket.SOCK_DGRAM)
        self.socket.settimeout(timeout)
github Dinnerbone / mcstatus / mcstatus / protocol / connection.py View on Github external
def __init__(self, addr, timeout=3):
        Connection.__init__(self)
        self.socket = socket.create_connection(addr, timeout=timeout)
        self.socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)