SocketWrench .NET Edition

Application Design

SocketWrench .NET is designed to be flexible enough to address the needs of developers who have very basic needs, as well as those who have more complex requirements. As a result, the properties and methods for the class interface can be broken down into two general categories: a high level interface to perform common tasks, and a lower level interface which provides more control at the expense of being somewhat more complicated and requiring more coding. For example, consider the high level methods such as ReadLine and WriteLine. Using these methods, your application read and write lines of text to a socket much the same way that you would to a text file. You don't need to understand how the data is being exchanged, buffered and processed. Another example would be the StoreStream method which allows you to easily read a stream of data from the socket and store it in a file. The high level methods allow you to program against the component as though it is a "black box", where you can provide the input and process the output without concerning yourself with the details of what's going on behind the scenes.

However, in some cases it's necessary for an application to have more direct control over how the control operates or to take advantage of features that aren't explicitly supported by one of the higher level methods. As an example, there's the lower-level Read and Write methods which allow you to directly read and write blocks of data on the socket and manage the buffering and data processing directly in your application.

If you are generally new to Internet programming or are just getting started with SocketWrench, we recommend that you begin familiarizing yourself with the higher level methods using a basic synchronous (blocking) connection in a single-threaded application. Once you become more familiar with how the class works, then you can move on to more complex applications which leverage the lower level methods, taking advantage of asynchronous networking connections and so on.

One of the common pitfalls that developers can encounter with SocketWrench is the inclination to over-design the application from the start, and then become frustrated because they don't yet have a clear picture of how all the pieces fit together. Start out with a basic design and then as you become more familiar with how the class works, expand on it.