parent
f92d59dd91
commit
34a3f06d91
5
bert.py
5
bert.py
|
@ -72,7 +72,7 @@ def connect(host, port):
|
||||||
global irc
|
global irc
|
||||||
print("Connecting to "+host+":"+str(port))
|
print("Connecting to "+host+":"+str(port))
|
||||||
context = ssl.create_default_context()
|
context = ssl.create_default_context()
|
||||||
with socket.create_connection((host, port)) as sock:
|
with socket.create_connection((host, port), timeout=180) as sock:
|
||||||
irc = context.wrap_socket(sock, server_hostname=host)
|
irc = context.wrap_socket(sock, server_hostname=host)
|
||||||
|
|
||||||
|
|
||||||
|
@ -141,6 +141,9 @@ def me(chan, msg):
|
||||||
|
|
||||||
def getData():
|
def getData():
|
||||||
raw = irc.recv(4096)
|
raw = irc.recv(4096)
|
||||||
|
if not raw:
|
||||||
|
print("Connection lost!")
|
||||||
|
sys.exit(0)
|
||||||
try:
|
try:
|
||||||
data = raw.decode("UTF-8")
|
data = raw.decode("UTF-8")
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user