Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.is_connected not working #65

Open
ryanwe1ss opened this issue Feb 16, 2022 · 3 comments
Open

socket.is_connected not working #65

ryanwe1ss opened this issue Feb 16, 2022 · 3 comments
Milestone

Comments

@ryanwe1ss
Copy link

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.

@fpagliughi
Copy link
Owner

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.

@fpagliughi fpagliughi added this to the v0.9 milestone Jan 18, 2023
@AndersHogqvist
Copy link

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.

@fpagliughi
Copy link
Owner

Yeah, I agree the name is misleading; a poor choice. I will consider renaming it with the v2 release. Then I can make some breaking changes.

@fpagliughi fpagliughi modified the milestones: v1.1, v2.0 Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants