This procedure does the processing of a datagram received from the network:
It checks the checksum and if it is bad disposes of the packet received.
It checks for a matching TCB and if none is found, it sends a reset and disposes of the packet received.
It checks the sequence number and if it is outside the window,
it sends an ack and disposes of the packet received.
It processes resets; if the packet contains a reset, processing is finished.
It processes acks.
It processes urgents.
It queues the segment on the TCB FromNet queue in sequence number order.
It processes packets on the FromNet Queue until the next expected sequence number is not present:
It processes SYNs.
It processes data and sends it to the user.
It processes FINs.