Applications which use the SocketTools classes will tend to have a similar structure, regardless of the specific protocol or programming language. While the details vary based on the control being used, the implementation can be broken down into several general steps:
Initialization prepares an instance of the class to be used by
your program, and is the first step that must be performed before
you can use any other methods. Next, a connection is established
with the server using the information provided by your program. For
example, most of the connection methods require that you provide a
host name, port number, a timeout period for synchronous operations
and any additional options.
If the protocol requires that you authenticate the client in order
to use the service, your application needs to provide this
information. Once the client has been authenticated, it can then
perform one or more operations, such as downloading a file, sending
an email message and so on.
After you have finished, you disconnect from the server. Finally,
before your program terminates, you uninitialize the class instance
which causes it to perform any necessary housekeeping prior to
releasing any system resources which were allocated on behalf of
your program.