B.10 transmit state machine, B.10, Transmit state machine – Schneider Optics Web Embedded Server User Manual
Page 82

Ethernet Developers Guide
72
840 USE 115 00 Version 1.0
B.10
Transmit State Machine
The transmit state machine establishes a connection, and periodically transmits a 
request. The different states for the transmit state machine are as follows. 
z
IDLE. In the IDLE state, there is no connection.
z
RESOLVING_NAME. In the RESOLVING_NAME state, CSample_View is 
waiting for the window socket DLL to convert a node’s name into an IP 
address. 
z
CONNECTING. In the CONNECTING state, CSample_View is waiting for the 
window socket DLL to generate the FD_CONNECT event. This event 
indicates if the attempt to establish a connection succeeded or failed. 
z
CONNECTED. The CONNECTED state indicates that a connection has been 
successfully established. 
z
WAIT_TO_TX. In the WAIT_TO_TX state, CSample_View is waiting to 
transmit the message. It transmits the message, when the time from the last 
transmit exceeds the specified poll interval. 
z
BLOCKED. When CSample_View attempts to send a message, the window 
socket DLL may not be able to transmit the complete message. This is a flow 
control condition, and CSample_View enters the BLOCKED state. The 
window socket DLL generates the FD_WRITE event when it can send more 
data. 
z
TX_DONE. CSample_View enters the TX_DONE when it has completed 
transmitting the request.
If the CSample_View is in the IDLE state, and user selects either the connect menu 
item, or the connect tool bar button, CSample_View OnManagConnect function 
attempts to establish connect with its tcpip_initate_connection function. This 
function examines the remote destination and determines if it’s a name or an IP 
address. If it’s a name, OnMangConnect changes the transmit state to 
RESOLVING_NAME, and it invokes the window sockets DLL 
WSAAsyncGetHostByName function to resolve the name. Window sockets DLL 
will generate the user defined WM_TCPIP_NAME_RESOLVED message which 
indicates if the name has been resolved. The OnTcpIpNameResolved member 
function process the WM_TCPIP_NAME_RESOLVED message. If the name is not 
resolved, OnTcpIpNameResolved changes the transmit state back to IDLE.
