Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
To use a Socket for server-side communications, your sequence of actions will run something like this:
Initialize the Socket's Port property with the port number on which the server is to listen.
Send the Socket the Listen message. When an incoming connection is established, the Socket will receive a Connected event.
You will be notified of any incoming commands from the client by means of the DataAvailable event. You'll typically clean out the buffer with the Read or ReadAll method.
Speak to the client by means of the Socket's Write method.
If any error occurs, you will receive an Error event; you can read the error number as the Socket's LastErrorCode property.
When finished, send the Socket the Close message to disconnect from the network.