Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changes between Version 8 and Version 9 of ChapterNetworking

Show
Ignore:
Author:
JJR (IP: 207.194.78.220)
Timestamp:
04/11/07 21:39:22 (17 years ago)
Comment:

Cleanup of original and more additions

Legend:

Unmodified
Added
Removed
Modified
  • ChapterNetworking

    v8 v9  
    33= An Introduction to Networking with Tango = 
    44 
    5 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 construction using C language structures, and another concerns its origins from Unix design history. 
    6  
    7 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. 
    8  
    9 Tango seeks to do much the same for the D language by delivering several basic network interface components on which we can build more complicated client or server applications.   The design is intended to follow a model consistent with the rest of the library, thus providing a shallower learning curve for the whole.  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.  D's object oriented features are once again applied to create a framework for logical and concrete network communication.   
     5Tango delivers fundamental network interface components with which we can design client or server applications. These network objects are similar enough to original networking library models to ease the transition for skilled network software developers.  The general goal of the Tango network modules is to simplify the whole approach to D network software development. 
    106 
    117== A History == 
    128 
    13 Berkley Software Distribution Unix made it's imprint in networking history during the last few decades of the twentieth century.  BSD Unix, as the academic-originating Unix operating system came to be called, was a direct competitor with Bell Lab's Unix distribution.  Bell Lab's Unix was the original design of what became the most popular OS model of the last half a century.   
    14 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.  
     9Berkley Software Distribution UNIX made it's imprint in networking history during the last few decades of the twentieth century.  BSD UNIX, as the academic-born UNIX operating system came to be called, was a direct competitor with AT&T Bell Lab's UNIX distribution.  Bell Lab's UNIX was the original design for what became the most popular OS model of the last half a century. Both UNIX designs eventually contributed important network protocols and interfaces that are in common use today.  The Internet is the most obvious example of the UNIX influence.  
    1510 
    16 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 ). 
     11BSD's style of UNIX ended up being adopted by a number of software industry leaders, the highest profile being Sun Microsystem's SunOS.  The two UNIX distributions, BSD and Bell Lab's, were distinctly incompatible for a number of years, demonstrating a divergent style in their intrinsic tool sets.  BSD developed some innovative programming interfaces during this period, and these were readily adopted in many highly popular server products.  Later versions of these two operating systems shared more in common.  Bell Lab's final major release, called System V, merged features and tools from BSD. This made the operating system more useful but not necessarily more compatible. (citation) 
    1712    
    18 One of the most important API's to surface from BSD came to be called BSD Sockets.  In short order BSD Sockets became practically a standard across many non-BSD Unix distributions as well.   
     13In the networking programming sector, one of the most important API's to surface out of this drama was "BSD Sockets."  In short order, BSD Sockets became practically a standard across many UNIX-derivative distributions. 
    1914 
    20 The purpose of BSD Sockets was to create a programming interface that conceptualized a plug-in connection principle for software that communicated across a network.  The Socket concept was the high level rendition of network communication.  Years later, sockets have become synonymous with network software development, promoted even further by their ready adoption by the ever pervading Linux movement. 
     15The purpose of the socket API was to create a "simple" programming interface for interprocess communication, specifically oriented to network operation.  The socket concept was the high level rendition of network communication.  Years later, sockets have become synonymous with network software development, promoted even further by their ready adoption by the ever pervading Linux movement. 
    2116 
    2217== All about Networking == 
    23  
    24 The Tango network interface begins with the Socket. The Socket component in Tango is a class that thinly veils a BSD Socket.   Since the Tango Socket is merely a BSD Socket with a object oriented interface,  it follows that both share a common technical description.  Learning about the original socket design is the first step to learning to program a network application or library. 
    25  
    26 But just before we discuss the Socket component, let us review some basics about networking in general. The first involves the definition of a computer network. 
    2718 
    2819Simply, a network is a collection of computers that communicate with each other through a transmission medium.  The communication mechanism must be managed like any other resource to prevent complete pandemonium amongst the connected computers, much like a group of children must be made to talk in turn in order for their speech to be intelligible. 
    3223These protocols are rules that state how network components agree to communicate. They are integrated into hardware or software and are present in multiple levels of any network model. 
    3324 
    34 Networks have come into such prominence that eventually a standard model was designed to describe how to connect combinations of devices for communication. (Complete Encyclopedia of Networking, p 727).  The Open Systems Interconnection (OSI Reference Model) is a seven-layer model meant to demonstrate the functional layers of a network and the features available in each layer. (p 727)  
     25Networks were coming into such prominence that eventually a standard model was designed to describe how to connect combinations of devices for communication. (Complete Encyclopedia of Networking, p 727).  The Open Systems Interconnection (OSI Reference Model) is a seven-layer model meant to demonstrate the functional layers of a network and the features available in each layer. (REWORD LAST SENTENCE COMPLETELY)  
    3526 
    36 A layer represents a high or low level contributer to the whole network model.  For example, a software application with its protocols represents the highest level Application Layer of the OSI (FTP and Telnet are application layer protocols); TCP and UDP protocols represent a middle layer called the Transport Layer; and the transmission line (wired or wireless) represents the the lowest layer called the Physical Layer. (Ibid. p 734) See the figure for a full view of the seven layer model. (need to add picture here) 
     27A layer represents a functional contributer to a portion of the network model. For example, a software application with its protocols represents the highest level Application Layer of the OSI (FTP and Telnet are application layer protocols); TCP and UDP protocols represent a middle layer called the Transport Layer; and the transmission line (wired or wireless) represents the the lowest layer called the Physical Layer. (Ibid. p 734) See the figure for a full view of the seven layer model. 
    3728 
    38 The OSI model acts as a guideline only, an abstract breakdown of how network systems operate.  Most networks systems with their operating system will implement most of these layers, but they won't be so clearly defined. Some layers may be logically merged for convenience; practicality wins out over theory in these cases
     29The OSI model acts as a guideline only, an abstract breakdown of how network systems operate.  Most networks systems will implement most of these layers, but they won't be so clearly defined. Some layers may be logically merged for convenience
    3930 
    40 What the OSI model should indicate is that communication happens in layers.  The model helps us understand how network systems work: when we make a connection with another computer, there are several processes that go on, each playing an important part in carrying the payload (the packet) to the destination.  Each level generates overhead in carrying the payload; this overhead is generated in exchange for reliability or functional necessity to meet the final purpose.  Also realize that each layer at the destination sees its equivalent layer at the source.  This means that packets are passed down the layers at the source and back up the layers at the destination; the destination levels strip off the pertinent information designated for their specific layer until the packet is presented in its naked form to the Application Layer.  This process will be useful to understand when we discuss the Tango Socket later in this chapter. 
     31What the OSI model should indicate is that communication happens in layers.  The model helps us understand how network systems work: when we make a connection with another computer, there are several processes that go on, each playing an important part in carrying the payload (the packet) to the destination.  Each level generates overhead in carrying the payload; this overhead is the price paid by the delivery system in exchange for reliability and functionality.   
    4132 
    42 There are many physical layouts, hardware arrangements, and network types that are important for the network implementer to understand. But the application programmer's need not deal with these things in most cases.  So we will avoid going into any more abstract level details and move directly into what a description of the socket and how it fits into the network model from the programmer's perspective.  
     33Each layer at the destination sees its equivalent layer at the source.  This means that packets are passed down the layers at the source and back up the layers at the destination; the destination levels strip off the pertinent information designated for their specific layer until the packet is presented in its naked form to the Application Layer.  This process will be useful to understand when we discuss the Tango Socket in the next section. 
    4334 
    44 == Sockets in Detail == 
     35== Tango Socket == 
    4536 
    46 ... Work in Progress ..
     37The socket is our fundamental network component and the basis for many higher level Tango network objects. In Tango this class represents a BSD Socket equivalent. The major difference is that Tango sockets are cross-platform: whether we use them on Apple OS X, MS Windows, or Linux, the interface remains the same.  Learning the details of Socket class, therefore, is the first step to learning to program a network application or library
    4738 
     39Like the name implies, a socket is a medium for connecting one entity to another.  The entities involved are always processes (software running on an operating system) that may exist on local or distributed network nodes (computers).  Each process must create a socket in order to establish a communication portal.  From the application perspective, the location of the communicating nodes is unimportant so long as the nodes are members of an operational network.  This is because lower level mechanisms, not visible to the application, take care of details important to actual delivery of the information submitted to the sockets.  For these reasons, sockets are really just a generic mechanism for interprocess communication (often known as IPC).  (CLEANUP) 
    4840 
    49 == Socket Programming == 
     41A data collection that is sent or received in this model is called a packet.  A packet contains useful information that one processes delivers to another for further processing.  Examples of packets would be anything from email's sent out on the Internet to web pages being downloaded from a distant server. 
     42Though packets may be almost any size, practicality in network communication design dictates that information transferred must be broken up into smaller parts before transmission.  While the application may see the received web page as a whole, lower level layers will usually partition large payloads into smaller.  These packets are sections of the whole transmitted in designated byte sizes.(CLEANUP) 
    5043 
    51 An excellent guide to low-level socket programming is right [http://beej.us/guide/bgnet/output/htmlsingle/bgnet.html here]. 
    52  
    53 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. 
    54  
    55 SocketConduit 
    56  
    57 ServerSocket 
    58  
    59 DatagramConduit 
    60  
    61 MulticastConduit 
    62  
    63  
    64  
    65 Uri represents Internet URLs: 
    66  
    67 [[Image(source:/trunk/doc/images/Uri.gif)]] 
    68  
    69 This is the Internet equivalent of !FileConduit: 
    70  
    71 [[Image(source:/trunk/doc/images/SocketConduit.gif)]] 
    72