I have a disconnect button and a connect button on my client. When I click the disconnect button and then the connect button I get this: OSError: [WinError 10038] An operation was attempted on something that is not a socket
The disconnect button is coded like this:
def Disconnect():
s.shutdown(socket.SHUT_RDWR)
s.close()
And the connect button is this:
def Join1():
print("CONNECTING TO: " + host + "...")
try:
s.connect((host, port))
print("CONNECTING TO: " + host + " ESTABLISHED!")
statusbar_status = "Connected"
startrecv = Thread(target=returnrecv)
startrecv.start()
Why can't I connect again after I click the disconnect button? Is it impossible to reopen the socket? I've been stuck on this problem for like a month now and I can't understand why..