User guide
Ethernet Developers Guide
840 USE 115 00 Version 1.0
 69
B.7  The CSample_View Class 
The CSample_View class mana
g
es the TCP/IP connection, sends re
q
uests to 
remote nodes, and displa
y
s either connection state, or the results of a transaction. 
In addition it sets the states of the tool bar buttons and menu items. 
B.7.1 Accessing TCP/IP 
The CSample_View interfaces with window sockets via its application 
pro
g
rammin
g
 interface, and via messa
g
es sent b
y
 the window sockets DLL to the 
CSample_View window. The reference for the window socket API is 
g
iven above. 
The first call made to the window sockets DLL must be WSAStartup. This call is 
made b
y
 InitInstance member function of the CSample_app class. The last call to 
the window socket DLL must be WSACleanup. This call is made b
y
 the 
ExitInstance member function of the Csample_app class.
The CSample_View allocates and sets the socket attributes. The attributes it sets 
are 
g
iven in the followin
g
 table.
Set Lin
g
er to cause a hard close
Receive out of band data in the normal data stream
Disable Na
g
el al
g
orithm for send coalescin
g
When Na
g
el al
g
orithm is disabled, if the stack receives an application messa
g
e, it 
will immediatel
y
 pass the messa
g
e to the application and will send a TCP/IP 
acknowled
g
ment messa
g
e. Althou
g
h this can 
g
enerate more traffic, the application 
receives the messa
g
e sooner then if Na
g
el al
g
orithm is enabled. The member 
function tcpip_setsocket_options sets the socket attributes.
The window socket interface provides the WSAAs
y
ncSelect function which notifies 
the window of network events. The member function tcpip_setsocket_options calls 
WSAAs
y
ncSelect function. The different events are 
g
iven b
y
 the followin
g
 table.
Event Description
FD_READ A socket can read data
FD_WRITE A socket can write data
FD_OOB A socket can read out of band data
FD_CONNECT A connect response has been received
FD_CLOSE The connection has been closed










