[Ns-bugs] [Bug 424] TCP FIN notification callback needed
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Sun Mar 29 22:17:27 PDT 2009
http://www.nsnam.org/bugzilla/show_bug.cgi?id=424
--- Comment #6 from Rajib Bhattacharjea <raj.b at gatech.edu> 2009-03-30 01:17:27 EDT ---
>From the article Tom posted:
What we can do however is issue a shutdown(), which will lead to a FIN packet
being sent to program B. Program B in turn will close down its socket, and we
can detect this from program A: a subsequent read() will return 0.
This scenario (of detecting EOF when reading from the socket) is supported by
the current TCP implementation; the packet you get in the RecvCallback will
have Size=0 only when the read reaches EOF, which is when the read hits the
data that had the FIN on it originally.
So the question becomes making sure Shutdown's semantics are correct?
Accordingly, Tom's suggestion for how to close a socket becomes:
when done writing, call ShutdownSend()
wait for RecvCallback to give an empty packet; then you know the other end has
sent a FIN too;
call close() (which might be meaningless in ns-3, since in *NIX, calling it at
this point it tantamount to kernel resource cleanup, it shouldn't have any
network effect at all)
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the Ns-bugs
mailing list