# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Author: Ytturi
# Author's e-mail: ytturi@protonmail.com
# Version: 0.1
# License: MIT
# -----------------------------------------------------------------------------

from availability.confs import get_timeout
from socket import socket, AF_INET, SOCK_STREAM


def check_available(addr, port):
    s = socket(AF_INET, SOCK_STREAM)
    s.settimeout(get_timeout())
    try:
        s.connect((addr, port))
        s.close()
        return True
    except OSError:
        return False


def check_available_async(addr, port):
    return addr, port, check_available(addr, port)

33b6c81190d059ad35c9a2efc82c2f80d274683c
<mask token>

<mask token>


def check_available(addr, port):
    s = socket(AF_INET, SOCK_STREAM)
    s.settimeout(get_timeout())
    try:
        s.connect((addr, port))
        s.close()
        return True
    except OSError:
        return False


<mask token>

<mask token>


def check_available(addr, port):
    s = socket(AF_INET, SOCK_STREAM)
    s.settimeout(get_timeout())
    try:
        s.connect((addr, port))
        s.close()
        return True
    except OSError:
        return False


def check_available_async(addr, port):
    return addr, port, check_available(addr, port)

from availability.confs import get_timeout
from socket import socket, AF_INET, SOCK_STREAM


def check_available(addr, port):
    s = socket(AF_INET, SOCK_STREAM)
    s.settimeout(get_timeout())
    try:
        s.connect((addr, port))
        s.close()
        return True
    except OSError:
        return False


def check_available_async(addr, port):
    return addr, port, check_available(addr, port)

# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Author: Ytturi
# Author's e-mail: ytturi@protonmail.com
# Version: 0.1
# License: MIT
# -----------------------------------------------------------------------------

from availability.confs import get_timeout
from socket import socket, AF_INET, SOCK_STREAM


def check_available(addr, port):
    s = socket(AF_INET, SOCK_STREAM)
    s.settimeout(get_timeout())
    try:
        s.connect((addr, port))
        s.close()
        return True
    except OSError:
        return False


def check_available_async(addr, port):
    return addr, port, check_available(addr, port)
