-
Notifications
You must be signed in to change notification settings - Fork 560
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
[Patch] Improve IO::Socket::connected() documentation #14199
Comments
From [email protected]Created by [email protected]Attached doc patch for IO::Socket::connected() is the eventual disposition of http://www.nntp.perl.org/group/perl.perl5.porters/2014/08/msg218522.html It is essentially identical to the suggested wording posted here: http://www.nntp.perl.org/group/perl.perl5.porters/2014/10/msg221699.html the only differences being some minor wordsmithing. Perl Info
|
From [email protected]0001-Improve-connected-doc.patchFrom 1b346f7bfbfcf3107b3b89c8208bf0bf00ac0840 Mon Sep 17 00:00:00 2001
From: "Glenn D. Golden" <[email protected]>
Date: Tue, 28 Oct 2014 04:24:04 -0600
Subject: [PATCH] Improve connected() doc
---
dist/IO/lib/IO/Socket.pm | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/dist/IO/lib/IO/Socket.pm b/dist/IO/lib/IO/Socket.pm
index 625c71a..c98ea0b 100644
--- a/dist/IO/lib/IO/Socket.pm
+++ b/dist/IO/lib/IO/Socket.pm
@@ -499,8 +499,23 @@ C<use> declaration will fail at compile time.
=item connected
-If the socket is in a connected state the peer address is returned.
-If the socket is not in a connected state then undef will be returned.
+If the socket is in a connected state, the peer address is returned. If the
+socket is not in a connected state, undef is returned.
+
+Note that connected() considers a half-open TCP socket to be "in a connected
+state". Specifically, connected() does not distinguish between the
+B<ESTABLISHED> and B<CLOSE-WAIT> TCP states; it returns the peer address,
+rather than undef, in either case. Thus, in general, connected() cannot
+be used to reliably learn whether the peer has initiated a graceful shutdown
+because in most cases (see below) the local TCP state machine remains in
+B<CLOSE-WAIT> until the local application calls shutdown() or close();
+only at that point does connected() return undef.
+
+The "in most cases" hedge is because local TCP state machine behavior may
+depend on the peer's socket options. In particular, if the peer socket has
+SO_LINGER enabled with a zero timeout, then the peer's close() will generate
+a RST segment, upon receipt of which the local TCP transitions immediately to
+B<CLOSED>, and in that state, connected() I<will> return undef.
=item protocol
--
2.1.3
|
From @tonycozOn Sat Nov 01 10:20:26 2014, gdg@zplane.com wrote:
Thanks, applied as 7eb3f2c. Tony |
The RT System itself - Status changed from 'new' to 'open' |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#123096 (status was 'resolved')
Searchable as RT123096$
The text was updated successfully, but these errors were encountered: