why when trying to connect when the server does not respond "try" shows that it is connected?
I need to check the connection status. Every time, despite the timeout setting, it shows that it is connected ...
My code:
socket = GCDAsyncSocket(delegate: self, delegateQueue: DispatchQueue.main)
do {
try socket?.connect(toHost: "192.168.1.1", onPort: 5000, withTimeout: 5)
print ("connect")
}catch {
print("socket error")
}
And one more question,
i create two socket on the same port:
socket1.connect(toHost: "192.168.1.1", onPort: 5000, withTimeout: 5)
socket2.connect(toHost: "192.168.1.1", onPort: 5000, withTimeout: 5)
in func:
func socketDidDisconnect(_ sock: GCDAsyncSocket, withError err: Error?) {
...
}
How to detect which socket (socket1 or socket2 ) has been disconnected?