Ethernet Developers Guide
The member function rx_msg calls the window socket recv function to read data. The recv function either returns a non negative number that is the number of bytes read or it returns an error. If the number bytes read is zero, then the connection no longer exits, and rx_msg closes the socket, and sets the transmit state to IDLE. If the recv function returns the error indicating that no receive data is available, then rx_msg just returns. For any other recv function error, rx_msg closes the socket, and sets the transmit state to IDLE.
B.12 Displaying on the Screen
CSample_View m_display member indicates the display type. The different types of the displays and the CSample_View member functions for showing the display are as follows.
1.Displaying the connection state. The different connection states displayed are IDLE, RESOLVING NAME, and CONNECTING. ConnPaint member function displays the connection state.
2.GetStatsPaint member function displays the results of a get statistics request.
3.ClearStatsPaint member function displays the results of a clear statisitics request.
4.ReadRegPaint member function displays the results of a read register request.
5.WriteRegPaint member function displays the results of a write register request.
MFC architectual framework calls CSample_View OnDraw member function to process the window WM_PAINT message. OnDraw examines m_display member variable and calls the corresponding member function described in the previous paragraph. Whenever CSample_View needs to display a result, it calls Cview Invalidate function which causes a WM_PAINT message.
CSample_View is derived from MFC CScrollView class. This class handles the scroll logic. To perform the scroll logic, CScrollView requires the size of the document. It is informed of the document size via its SetScrollSizes member function.
CSample_View UpdateScrollSizes member function based on the display type calculates the document size, and then calls SetScrollSizes. CSample_View calls UpdateScrollSizes when the display type changes or when the user changes the window size.
76 | 840 USE 115 00 Version 1.0 |