・What am I doing:
A TCP server and A UDP “server” simultaneously
・What I have done in my code:
when I want to close the TCP socket or got a FIN
if the socket status is SOCK_ESTABLISHED then
DICONN
otherwise
CLOSE
・What happend:
got FIN
sent ACK
sent RST
・Then I changed my code as this:
when I want to close the TCP socket or got FIN
if the socket status is SOCK_LISTEN then
CLOSE
if the socket status is SOCK_ESTABLISHED or SOCK_CLOSE_WAIT then
DICONN
・What happend then:
got FIN
sent ACK, FIN
got ACK
sent RST
What am I asking:
What shold I do when I want to close the TCP socket or got a FIN?
For some reason I can not reconstruct the code.
Only this one function I can touch.
・Further question:
①Are these the all status that available in TCP server?
SOCK_INIT
SOCK_LISTEN
SOCK_ESTABLISHED
SOCK_CLOSE_WAIT
SOCK_SYNSENT
SOCK_SYNRECV
SOCK_FIN_WAIT
SOCK_FIN_WAIT
SOCK_CLOSING
SOCK_TIME_WAIT
SOCK_LAST_ACK
SOCK_ARP_0
SOCK_ARP_1
SOCK_ARP_2
②Is the SOCK_CLOSE_WAIT the only available status when got a FIN?
③When I want to close the TCP socket, what should I do when the the CHIP is in each status in ①?
④Are these the all status that available in UDP “server”?
SOCK_INIT
SOCK_UDP
SOCK_ARP_0
SOCK_ARP_1
SOCK_ARP_2
⑤When I want to close the UDP socket, what should I do when the the CHIP is in each status in ④?
Thank you.