Information Technology Reference
In-Depth Information
obj . Connect
Connects to a remote host (client invoked).
obj . Listen
Listens for a connection (server invoked).
obj . GetData
Reads data from the input steam.
obj . SendData
Sends data to an output stream.
The main events are:
ConnectionRequest
Occurs when a remote host wants to make a connection with a
server.
DataArrival
Occurs when data has arrived from a connection (data is then
read with GetData).
Figure 24.11 WinSock object
24.10.1
Creating a server
A server must listen for connection. To do this, do the following:
1 Create a new standard EXE project.
2 Change the name of the default form to myServer.
3 Change the caption of the form to 'Server Application' (see Figure 24.12).
4 Put a WinSock control on the main form and change its name to myTCPServer.
5 Add two TextBox controls to the form. Name the first SendTextData, and the second
ShowText (see Figure 24.12).
Search WWH ::




Custom Search