Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact
Version 6 (modified by JJR, 14 years ago)
Biginning the Ramblings.... woo hoo!

Leave Comments, Critiques, and Suggestions Here?

An Introduction to Networking with Tango

Network software development has earned the reputation for not only being a tedious pursuit but also having an alarmingly steep learning curve. There are some significant reasons for why this is the case: one relates to its itimacy with C language structures, and another concerns its historical connection with Unix design.

Over the last few decades, approaches to network programming were introduced using new programming paradigms. Probably the most prominent of these approaches were adapted to use advanced features in languages like Java and C++ (for example: C++'s ACE network framework). A higher level framework and more consistent programming model were intended to produce a less error-prone development cycle and simpler application construction.

Tango seeks to do much the same for the D language by delivering basic network interface components which act as building blocks for more complicated client or server software projects. The design is intended to follow a model consistent with the rest of the Tango library, so that experience gained while using Tango in general translates to a shallow learning curve for network programming in particular. D's object oriented features are adopted to create a framework for logical and concrete network communication.

The design of the individual components are also intended to be similar enough to original networking library models to ease the transition for skilled network software developers. For the beginner, much of the oddeties of low level C API's are eliminated; this means that learning can concentrate on the design details of the network programming task and less on specific interface anomalies. To accomodate differing levels of knowledge, this chapter will introduce some prequisite network programming details.

History

Berkley Software Distribution Unix made it's imprint in networking history during the last few decades of the twentieth century. BSD Unix, as the Unix operating system came to be called, was initially only an academic pursuit, but within a short time became a direct competitor with Bell Lab's System V Unix distribution. Bell Lab's Unix was the original design of what became the most popular OS model of the last forty years.

Each distribution eventually contributed the majority of the application programming interfaces we use today. Of particular importance was the contribution of networking protocols like TCP/IP. While there have been many influences and contributions from many parties, platforms, and operating systems, this "protocol stack", as the the Unix software layers came to be called, remains the most prevalent.

BSD's style of Unix ended up being adopted by a number of software industry leaders. The two Unix distributions, BSD and Bell Lab's System V, had parted ways early on and were largely incompatible. BSD managed to develop new programming interfaces that became readily adopted in many highly popular server products, the best example perhaps coming from Sun Microsystems ( SunOS ). (citation)

One of the most important API's to surface from BSD came to be called BSD Sockets. BSD Sockets eventually spread to many non-BSD Unix distributions. The purpose of BSD Sockets was to create a programming interface that conceptualized network connections in software and facilitated use of connectionless and connection-oriented communication protocols. The Socket concept was a high level rendition of network communication. Years later, the BSD sockets library has become synonymous with network software development. Prevalent operating systems like MS Windows, Mac OS X, and Linux now provide a compatible BSD Socket layer (citation).

The BSD Sockets library made its mark in industry; but despite this fact, network programming was still regarded as a specialty. It was a field only for gurus. Techniques and libraries involved were often so confusing and cryptic to apply that this view continued to proliferate unchecked. C was just not conducive to clear and concise coding, a fact that threatened to be an unshakable stigma for a field whose history encompasses a period of well over 30 years.

Sockets in Detail

... Work in Progress ...

Socket Programming

An excellent guide to low-level socket programming is right here.

Tango exposes this kind of low-level access via tango.net.Socket, but that is just too low-lowel for general usage. Thus, Tango provides a number of higher level wrappers to make Internet programming more productive.

SocketConduit?

ServerSocket?

DatagramConduit?

MulticastConduit?

Uri represents Internet URLs:

source:/trunk/doc/images/Uri.gif

This is the Internet equivalent of FileConduit:

source:/trunk/doc/images/SocketConduit.gif