Navigation bar
  Start Previous page  17 of 35  Next page End Home  7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  

Embedded Web Server for the CR16
National Semiconductor
Jeff Wright
second time TCP will infer that an error of some sort has occurred at the peer, and will
issue a RESET segment.  After sending the reset segment, TCP will revert to the listening
state and attempt to send the entire data again.   The timeout values used are fully flexible
and determined by macros in the TCP header file. 
Transmitting Data.
An application wishing to transmit data must first determine whether TCP is available by
checking the TCP_SEND flag.  If TCP is available, the application must fill in the necessary
fields in TCP’s API (indicating for instance, the location(s) of the data buffers to transmit),
and then set the TCP_SEND flag.  When the TCP task next runs, it will check for any
commands from the application(s).  Upon noting that the TCP_SEND flag is set, TCP will:
Use the *Socket (connection name) field to determine which TCP Control Block to
Determine whether the total data length exceeds that of the peer’s Maximum
Segment Size (MSS).  If it does exceed this limit, TCP will grab a “MSS-sized”
portion of the data, to ensure that the receiving TCP can handle the segment…
Acquire a TCP segment (if one is available) from the TCP segment manager, who
places the segment in the XmitQList.  If no segments are available, TCP must wait…
Compute the total segment length and record this number in the Length field…
Transcribe the current Sequence numbers from the socket’s control structure…
Compute the segment checksum and record it in the HdCkSum field…
Record the segment’s timeout value in its SegTimer field…
Fill the required pointer fields in IP’s interface with the appropriate buffer
Determine whether this is the final segment to send.  If so, set the FIN flag in the
TCP segment header.  Otherwise, only the PSH and ACK flags are set…
After ensuring that IP is available (by checking IP’s DLSEND flag), signal the IP
layer to transmit this segment by setting the DLSEND flag in IP’s interface …
Repeat steps two through nine above until all application data has been sent.
Once all application data has been transmitted, TCP will await ACKnowledgement of
the FIN segment, as well as any other un-ACK’d segments…
Upon receiving proper ACKnowledgements, the connection is closed.
This process is illustrated in Figure 10.  The application (HTTP in this case) collects the
various data and passes the relevant parameters on to TCP.   
Receiving Data.
TCP monitors the DLRECV flag in the Cmd field of IP’s interface data structure for received
segments.  Upon receiving a segment from IP, TCP will:
Confirm the segment’s checksum.  If incorrect, the segment is silently discarded (i.e.
Compute the payload length (application data) for use by the application … White Papers Previous page Top Next page