S
Srubys
Hiya
I’m learning about TCP/IP and this stuff is just overwhelming
1. As far as I understand, when the passive-close end receives the
FIN, it doesn’t know whether the other end wants to stay in half-close
state ( in this case it should send data ) or to do full close( in
this case, it should send FIN )
We use shutdownOutput() to achieve half close, and close() to fully
close the connection. Now if none of the two methods force the passive-
close end to start TCP close sequence, why do we then use shutdown()
for half close connection? Why not just use close(), since it looks as
if both methods basically do the same thing ( terminating socket’s
output stream )?
2. If app does complete close, then TCP prevents infinite wait in
FIN_WAIT_2 state with setting the timer to aprox 10 minutes and if
connection is idle for that time period, TCP moves connection to
closed state.
a) But if app does half close, then this timer is not set and TCP
could be in FIN_WAIT_2 state for a very long time?
3. If linger on close is set to false, does on close() socket enter
FIN_WAIT_1 and from there to CLOSING state, or does it enter
FIN_WAIT_1 and from there to FIN_WAIT_2 state?
4. If client performs active open, but for some reason server doesn’t
receive none of client’s acknowledgements of server’s SYN, then:
a) I’m assuming that client is in established connection state, but
server is not?
b) does server go to close state and thus sends FIN or does it go to
listening state?
If the latter is true, then we have half open connection?
thank you
I’m learning about TCP/IP and this stuff is just overwhelming
1. As far as I understand, when the passive-close end receives the
FIN, it doesn’t know whether the other end wants to stay in half-close
state ( in this case it should send data ) or to do full close( in
this case, it should send FIN )
We use shutdownOutput() to achieve half close, and close() to fully
close the connection. Now if none of the two methods force the passive-
close end to start TCP close sequence, why do we then use shutdown()
for half close connection? Why not just use close(), since it looks as
if both methods basically do the same thing ( terminating socket’s
output stream )?
2. If app does complete close, then TCP prevents infinite wait in
FIN_WAIT_2 state with setting the timer to aprox 10 minutes and if
connection is idle for that time period, TCP moves connection to
closed state.
a) But if app does half close, then this timer is not set and TCP
could be in FIN_WAIT_2 state for a very long time?
3. If linger on close is set to false, does on close() socket enter
FIN_WAIT_1 and from there to CLOSING state, or does it enter
FIN_WAIT_1 and from there to FIN_WAIT_2 state?
4. If client performs active open, but for some reason server doesn’t
receive none of client’s acknowledgements of server’s SYN, then:
a) I’m assuming that client is in established connection state, but
server is not?
b) does server go to close state and thus sends FIN or does it go to
listening state?
If the latter is true, then we have half open connection?
thank you