Mike Chambers
Veteran Member
- Joined
- Sep 2, 2006
- Messages
- 2,621
this is from peter tattam after i e-mailed about the status codes for TCPDRV/NTCPDRV. he apparently simply forgot to include them in his official spec sheet!
Peter Tattam said:Hmm. I thought those were documented, but when I looked at the spec, they weren't.
here you are... an enum starting at 0.
tcp_state = (closed,listen,syn_sent,syn_received,established,
fin_wait_1,fin_wait_2,close_wait,closing,
last_ack,time_wait);
3 would correspond to syn_received. This would happen on a listen socket when it hasn't got the ack from the other end. the usual sequence is....
(S = server, C= client)
sent state
S=LISTEN, C=CLOSED
C: SYN C= SYN_SENT
S: SYN/ACK S= SYN_RECEIVED
C: ACK C,S = ESTABLISHED
so the server would transition from LISTEN --> SYN_RECEIVED -> ESTABLISHED.
while the client would transition from CLOSED --> SYN_SENT -> ESTABLISHED
the transitions for closing are more complex. Check out the RFC's or read a book on TCP for more info.
if you want to know the internal format of the IP, TCP, UDP socket structures, I can let you have a sneak look. They are in Pascal though.
Peter