use socket.create_connection()
for dualstack and socket timeout
This commit is contained in:
parent
e3cdce4f12
commit
f92d59dd91
11
bert.py
11
bert.py
|
@ -38,10 +38,8 @@ y = "\x038"
|
||||||
r = "\x034"
|
r = "\x034"
|
||||||
g = "\x033"
|
g = "\x033"
|
||||||
|
|
||||||
context = ssl.create_default_context()
|
# global variable for the socket, see connect()
|
||||||
with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as sock:
|
irc = None
|
||||||
irc = context.wrap_socket(sock, server_hostname=host)
|
|
||||||
|
|
||||||
|
|
||||||
# Currency API
|
# Currency API
|
||||||
def get_exchange():
|
def get_exchange():
|
||||||
|
@ -71,8 +69,11 @@ def safeexit():
|
||||||
|
|
||||||
|
|
||||||
def connect(host, port):
|
def connect(host, port):
|
||||||
|
global irc
|
||||||
print("Connecting to "+host+":"+str(port))
|
print("Connecting to "+host+":"+str(port))
|
||||||
irc.connect((host, port))
|
context = ssl.create_default_context()
|
||||||
|
with socket.create_connection((host, port)) as sock:
|
||||||
|
irc = context.wrap_socket(sock, server_hostname=host)
|
||||||
|
|
||||||
|
|
||||||
def sendRaw(data):
|
def sendRaw(data):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user