Ethernet Developers Guide
The receive state machine (which is described below) processes the response to a request. When the receive state machine has completed receiving the response, it changes the transmit state machine from the TX_DONE state to the WAIT_TO_TX state.
Recall that the TransmitUserRequest saves the time. CSample_View OnPollInterval uses this saved time to determine if a new request needs to be transmitted. OnPollInterval is called by MFC architectural framework to process the WM_POLL_INTERVAL sent when CMainFram class processes the window timer message, WM_TIMER. OnPollInterval examines the transmit state. If the transmit state is WAIT_TO_TX, and the elapsed time from the previous transmit request exceeds the poll interval, then OnPollInterval calls TransmitUserRequest to start another transaction.
B.11 Receive State Machine
The receive state machine receives a response to a transaction by first reading the header, determining the size of the rest of the message, and then reading the body of the message. The different states of the receive state machine are as follows.
RX_HEADER. In the RX_HEADER state, the receive machine is receiving the message header.
RX_BODY. In the RX_HEADER state, the receive machine is receiving the
zresponse message associated to the requested transaction.
DUMP_BODY. In the DUMP_BODY state, the receive message is receiving a message, but there is no associated transaction with respect to this message.
The window socket DLL generates the FD_READ event whenever there is data to be read. If only part of the data is read, it generates another event. CSample_View OnTcpIpRead function processes the FD_READ event, and drives the receive state machine.
When a FD_READ event is generated it is possible that the complete message is not present. The remote node may have attempted to send a 100 byte response, but the transport system may have only had buffer space to transmit three bytes. The receiver will get a FD_READ for the three bytes. OnTcpIpRead calls CSample_View rx_msg to read the receive data into the buffer. There are three parameters to rx_msg. The first parameter is a pointer to a receive buffer. The second input parameter is the receive size. The third parameter is both an input and output parameter. On both input and output the third parameter is the number of bytes read. These parameters allow the processing of a partially received message.
74 | 840 USE 115 00 Version 1.0 |