
Ethernet Developers Guide
74
840 USE 115 00 Version 1.0
The receive state machine
which is described below
processes the response to a
re
uest. When the receive state machine has completed receivin
the response, it
chan
es the transmit state machine from the TX_DONE state to the WAIT_TO_TX
state.
Recall that the TransmitUserRe
uest saves the time. CSample_View
OnPollInterval uses this saved time to determine if a new re
uest needs to be
transmitted. OnPollInterval is called b
MFC architectural framework to process
the WM_POLL_INTERVAL sent when CMainFram class processes the window
timer messa
e, WM_TIMER. OnPollInterval examines the transmit state. If the
transmit state is WAIT_TO_TX, and the elapsed time from the previous transmit
re
uest exceeds the poll interval, then OnPollInterval calls TransmitUserRe
uest to
start another transaction.
B.11 Receive State Machine
The receive state machine receives a response to a transaction b
first readin
the
header, determinin
the size of the rest of the messa
e, and then readin
the bod
of the messa
e. The different states of the receive state machine are as follows.
RX_HEADER. In the RX_HEADER state, the receive machine is receivin
the
messa
e header.
RX_BODY. In the RX_HEADER state, the receive machine is receivin
the
response messa
e associated to the re
uested transaction.
DUMP_BODY. In the DUMP_BODY state, the receive messa
e is receivin
a
messa
e, but there is no associated transaction with respect to this messa
e.
The window socket DLL
enerates the FD_READ event whenever there is data to
be read. If onl
part of the data is read, it
enerates another event. CSample_View
OnTcpIpRead function processes the FD_READ event, and drives the receive
state machine.
When a FD_READ event is
enerated it is possible that the complete messa
e is
not present. The remote node ma
have attempted to send a 100 b
te response,
but the transport s
stem ma
have onl
had buffer space to transmit three b
tes.
The receiver will
et a FD_READ for the three b
tes. OnTcpIpRead calls
CSample_View rx_ms
to read the receive data into the buffer. There are three
parameters to rx_ms
. 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 b
tes read. These parameters allow the processin
of a partiall
received
messa
e.
Komentáře k této Příručce