You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've been trying to check if my socket that I have connected to a server is active in which it obviously is because I am able to send data back and forth, but is there any way I can check because I've been trying to use "socket.is_connected()" but it seems to be returning the same value no matter if it is connected or not. Currently using TCP sockets.
The text was updated successfully, but these errors were encountered:
Yeah, I had meant that to just be a check after the initial connection was attempted, succeeded, and is not yet closed. It's literally just checking for a valid socket descriptor (file handle).
Maybe it could be made more useful. I'd need to think about it a bit.
Usually you detect a closed connection by a failed read or write.
Yeah, I had meant that to just be a check after the initial connection was attempted, succeeded, and is not yet closed. It's literally just checking for a valid socket descriptor (file handle).
Maybe it could be made more useful. I'd need to think about it a bit. Usually you detect a closed connection by a failed read or write.
I was just about to ask the same question as @ryanwe1ss but that explains it. I would suggest changing the name of that method to something like is_valid() or similar instead of is_connected() if that isn't what it's actually checks.
Hi,
I've been trying to check if my socket that I have connected to a server is active in which it obviously is because I am able to send data back and forth, but is there any way I can check because I've been trying to use "socket.is_connected()" but it seems to be returning the same value no matter if it is connected or not. Currently using TCP sockets.
The text was updated successfully, but these errors were encountered: