Chapter 1

powered by FreeFind

Modified: 

Definitions

RFC Documents
RFC Numbers Topic
788, 821 SMTP (Simple Mail Transport Protocol)
1738 URLs (Uniform Resource Locator) in the WWW
114, 172, 265, 354 FTP (File Transfer Protocol)

1.3 Network Software

1.3.1 Protocol Hierarchies

The figure at right illustrates a typical, five layer network. Virtual communication occurs horizontally between common layers on the hosts, the common layers are peers. From the perspective of each peer, all communication is with the peer on the other host. In fact, the real communication occurs vertically between layers on a single host. The only direct communication can occur at the lowest or physical layer (e.g. over the wire).

In the figure below, protocols virtually communicate horizontally through the real vertical communication layers. A Web client implements the protocol to communicate with a Web server, however the real communication must pass from the client down through interfaces to the underlying layers, across a physical connection that actually carries the bits, then up through the layer interface to the Web server protocol implementation.

A more detailed illustration of the vertical communication is below. As a message at Layer 5 is sent from a host, it moves down the layers. Each layer communicates virtually horizontally with its peer by adding information to the message received from the higher layer, this information is usually termed a header or trailer. For example, the information added by the sending host at layer 3 is used at layer 3 on the receiving host, the headers and trailers implement the virtual communication. On reaching the destination host, the message moves from lower to higher layers. Each peer layer examines and removes the header (or trailer) before passing the message to the next higher layer.

1.3.2 Design Issues for the Layers

  1. Addressing - Each layer must be able to identify senders/receivers.
  2. Data transfer
  3. Error detection - Possible correction or retransmit. Requires additional information such as parity bits.
  4. Sequencing - When channel does not preserve order, receiver must reorder.
  5. Flow control - Preventing fast sender from overwhelming receiver.
  6. Message size - Cannot accept arbitrarily long message though short messages are inefficient due to protocol overhead.
  7. Multiplexing - Use of same channel for multiple messages simultaneously (e.g. closed caption TV, phone trunks, or simultaneous FTP, SMTP, HTTP over same channel).
  8. Routing - Directing message to correct destination. When multiple paths, possible to use most efficient routes or several simultaneously. 

1.3.3 Interfaces and Services

1.3.4 Connection-Oriented and Connectionless Services  - Between layers

1.3.5 Service Primitives

Primitive Meaning
Request An entity wants the service to do some work.
Indication An entity is to be informed about an event.
Response An entity wants to respond to an event.
Confirm The response to an earlier request has come back

Consider how, in the following figure,  a connection is negotiated between two systems with A initiating a connection to B.

  1. The connection request is made on system A through the Request primitive and the Connect system B parameter.
  2. The request is delivered to system B, generating an event that a connection request has been made.
  3. System B responds to A with the connection request acceptance.
  4. The response is delivered to A, generating an event on its arrival confirming the connection.

The following figure illustrates how an email application on system A might use the TCP layer services to establish a connection to the email application on system B. Note that layers below TCP are not shown but would be used.
 




Layer n+1

Layer n
 
 
 

Layer n+1
 

Layer n

 

1.3.6 The Relationship of Services to Protocols

send("Hello");                                         Layer n+1 calls function at Layer n
private void send(char packet[]);                Layer n implements function

 

Note that send is implemented at Layer n where implementation is hidden and isolated though interface (function prototype) is visible to layer n+1.

 

Exercise  - Simulate the operation of a four layered communications protocol.
  1. Arrange seat rows of four people numbering each row. The number is the physical location.
  2. Person at head of row is Layer 4, have them pick a funny name as their address. Write their names on the board.
  3. Tell each Layer 2 person their address and physical location (seat row).
  4. Each layer (person) performs two tasks (send and receive) by following the protocol.
Layer 4

Application

send
  1. Write a clean message on paper
  2. Write destination address on sticky note
  3. Pass to layer 3 via send( message, address)
    • Pass the two papers to person behind you
receive
  1. Call Layer 3 receive(message, address) and wait for results
  2. Read: address sent me message.
  3. Go to 1
Layer 3

Transport

send( envelop, address )
  1. Fragment message (tear in fragments)
  2. Place each fragment in an envelop
  3. Write fragment number and total number of fragments on envelop
  4. Write destination address on sticky note for each envelop
  5. Pass to layer 2 via send(envelop, address)
    • Pass each envelop and sticky note to person behind you
receive(message, address)
  1. Call Layer 2 receive( envelop, address) and wait for results
  2. Remove fragment from envelop.
  3. Place fragment in correct sequence.
  4. If all fragments received:
    • Write address on sticky note
    • Pass to Layer 4 assembled fragments and address
      • Person in front of you
  5. Go to 1
Layer 2

Network

send(envelop, address)
  1. Place envelop in an envelop.
  2. If you do not know the physical location of the destination address
    • Locate physical location (seating row) of address on network.
    • Call out "where is address _____"). Remember it
  3. Copy destination address and your source address on envelop
  4. Write destination physical location on sticky note
  5. Pass to layer 1 (person behind you) via send(envelop, physical location)
receive(envelop, address)
  1. Call Layer 1 receive(envelop) and wait for results
  2. Remove envelop from envelop.
  3. Write source address on sticky note
  4. Pass to Layer 3
    • Person in front of you
  5. Go to 1
Layer 1

Physical

send(envelop, physical location)
  1. Place envelop in an envelop.
  2. Write physical location on new envelop
  3. Pass the envelop to physical location (person at back seat of row)

 

receive(envelop)
  1. Remove envelop from envelop.
  2. Pass to Layer 2
    • Person in front of you
TCP client - echoclient.cpp
//      echoClient.cpp - Use: echoClient <IP> or <DNS>
//      Visual C++ Project | Settings | Link | Object/Library modules | ws2_32.lib 

#define WIN32_LEAN_AND_MEAN 
#include <winsock2.h> 
#include <iostream.h>

int main(int argc, char* argv[])              
{       char                          buffer[128]; 
        int                             retval; 
        unsigned int                addr=0; 
        struct sockaddr_in        sin; 
        struct hostent             *host; 
        WSADATA                   wsaData; 
        SOCKET                      s; 
 
        WSAStartup(0x202,&wsaData);                                // Startup 
                                                                                                
        host = gethostbyname(argv[1]);                              // Try DNS lookup

        if (!host)                                                               // DNS failed try as IP
                addr = inet_addr(argv[1]);  
        if ((!host)  && (addr == INADDR_NONE) ) {               // DNS and IP failed 
                cout << "Unable to resolve " << argv[1] << '\n'; 
                return -1; 
        }  
        if (host != NULL) {                                                     // Copy server info 
                memcpy(&(sin.sin_addr),host->h_addr,host->h_length); 
                sin.sin_family = host->h_addrtype; 
        }
        else {
                sin.sin_addr.s_addr = addr; 
                sin.sin_family = AF_INET; 
        }
        sin.sin_port = htons(889);
                                                                         
        if ((s = socket(AF_INET, SOCK_STREAM,0)) == INVALID_SOCKET){  // Create socket
                cout << "socket() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
        }                                                                                // Connect to server port
        if (connect(s,(struct sockaddr*)&sin,sizeof(sin)) == INVALID_SOCKET) { 
                cout << "connect() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
        } 
        cout << "Opened connection.\n"; flush(cout);
        
        while(cin >> buffer) {                                               // Read behaved user input
                buffer[sizeof(buffer)]='\0';                                 // allows buffer over run
                                                                            
                send(s,buffer,strlen(buffer)+1,0);                  // Send to echo server
                                                                                
                retval=recv(s,buffer,sizeof(buffer),0);             // Receive echo from server
                                                                                
                if(retval < sizeof(buffer)) buffer[retval]='\0';        // 0 terminate buffer
                                                                                               
                cout << "Received " << buffer << "\n";   flush(cout); // print the server
        } 
        closesocket(s);                                                                // Close connection
        cout << "Closed connection.\n"; flush(cout);
        return 0;
}
TCP server - echoserver.cpp
//      echoServer.cpp - Use: echoServer
//      Visual C++ Project | Settings | Link | Object/Library modules | ws2_32.lib 

#define WIN32_LEAN_AND_MEAN 
#include <winsock2.h> 
#include <iostream.h>

int main(void)
{      char                            buffer[128]; 
        int                               retval, sinlen; 
        struct sockaddr_in       sin; 
        WSADATA                    wsaData; 
        SOCKET                       s, h; 

        WSAStartup(0x202,&wsaData); 
        sin.sin_family = AF_INET; 
        sin.sin_addr.s_addr = INADDR_ANY;
        sin.sin_port = htons(889);                           // Port 889
                                                                           // SOCK_STREAM is TCP
        if ((s = socket(AF_INET, SOCK_STREAM,0)) == INVALID_SOCKET){ 
                cout << "socket() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
        }                                                                  // Bind socket to local port    
        if (bind(s,(struct sockaddr*)&sin,sizeof(sin) ) == SOCKET_ERROR) { 
                cout << "bind() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
        }                                                                  // Listen for socket connection
        if (listen(s,1)== SOCKET_ERROR) { 
                cout << "listen() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
        } 
        sinlen = sizeof(sin); 
        
        while(1) {                                                      // Accept incoming connection   
          if ((h=accept(s,(struct sockaddr*)&sin,&sinlen )) == INVALID_SOCKET) { 
                cout << "accept() failed with error " << WSAGetLastError() << '\n'; 
                return -1; 
          } 
          cout << "Opened connection.\n";       flush(cout);
                                                                           // receive while connection open
          while((retval=recv(h,buffer,sizeof(buffer),0)) != SOCKET_ERROR && retval != 0){ 
                if(retval < sizeof(buffer))                      // Make into 0 terminated string
                        buffer[retval]='\0';
                cout << "Received " << buffer << "\n";   flush(cout); 
                                                                            // Echo what was received
                send(h,buffer,strlen(buffer)+1,0);
          } 
          closesocket(h);
          cout << "Closed connection.\n";       flush(cout);
        }
        return 0;
}


1.4 Reference Models

1.4.1 OSI Reference Model

A standard model that has not been widely implemented but is of value primarily as an example of a well designed model that can be used to understand network organization. It is not an architecture since it does not specify the services and protocols of each layer but rather what each layer should do. Most operational network architectures such as TCP/IP can more or less be represented using a partial model. From bottom to top the OSI model is:

  1. Physical - Mechanical connection, electrical characteristics (voltage, timing,), medium of transmission (wireless, Category 5, fiber). Hosts are physically connected by this layer. Ethernet is an example.
  2. Data Link - Raw bit transmission, assembles data as frames since physical layer handles streams of bits, requires a framing boundary. For example, sending 11111111110010000011111111111101010101011111, a stream of 1's indicate no data, the first 0 is the start of data, followed by 8 data bits, then more 1's for no data, etc. The first 0 acts to frame the 8 data bits of 01000001 (the ASCII code for "A") that follow.
  3. Network - Main job is routing messages from a source to a destination. The IP layer of TCP/IP.
  4. Transport  - Break up and assemble data between network and session layer since session message may be too large for network layer. Implements connections to destination host's transport layer. Handles flow control preventing fast sender from overwhelming receiver. The TCP layer if TCP/IP.
  5. Session - A session consists of all messages passed between two hosts to complete some operation. For example, an email session consists of the sending machine connecting to the receiving machine, passing the mail recipient's address and message, the disconnecting.
  6. Presentation - Data representation or other common standards (use of ASCII, Unicode, etc.).
  7. Application -  User interface to network (email, ftp, Web).

The OSI model is today important primarily as a point of reference from which other protocols are typically discussed.

Data Transmission in the OSI Model - The figure below illustrates how data would flow using the OSI model, where peer communications occurs through headers added to the higher layer message.

1.4.2 TCP/IP Reference Model

Example

Transmit and receive an email message using the following, simplified TCP/IP reference description.

5. Application layer
  • email - SMTP (Simple Mail Transfer Protocol). Adds 1) email sender and 2) recipient address header (e.g. rwisman@ius.edu) to message. Passes to TCP with 1) recipient network address and 2) port parameters (normally send and receive on TCP application port 25). Removes sender and recipient address from message and delivers (e.g. to rwisman).
4. Transport layer 
  • TCP (Transport Control Protocol) - Adds 1) source and 2) destination application port and 3) message ID number header to message. Fragments large message adding 4) fragment number and common message ID number header. Passes to IP 1) destination network address (e.g. ius.edu=149.160.30.25) and 2) protocol (e.g. TCP or UDP) parameters. Removes added port, ID and fragment headers and reassembles fragments before delivery to receiver application port.
3. Network layer
  • IP (Internet Protocol) the internet layer. Adds 1) host destination, 2) source network address and 3) protocol headers (TCP) to message. Passes to interface (we assume only one here) 1) protocol (e.g. IP) parameter. Rejects non-broadcast messages to other IP network address. Removes network address and protocol headers and delivers to protocol (e.g. TCP).
2. Host-to-Network Interface 
  • Data-link layer. Adds 1) source and 2) destination NIC number headers to message. Rejects non-broadcast messages to other NIC number. Passes bits to physical as voltages, light, etc. Removes NIC headers, delivers to to protocol (e.g. IP).
1. Physical 
  • Physical network for transmitting/receiving raw bits, concerned with timing, voltage, etc. Voltages, light, etc. received from/delivered to connected NIC.

1.5 Example Networks

1.5.1 Novell Netware

Popular as PC LAN protocol for client-server networking. As the figure at right illustrates, the physical and data link can be one of several, it is not uncommon to have both Ethernet and Token-ring NICs and other protocols in a single host. This will be examined in more detail later.

The network layer is unreliable, connectionless inter-network protocol IPX (Internet Packet eXchange) that passes packets transparently from source to destination, even to different networks.

The transport layer has two protocols, SPX (Sequenced Packet eXchange) is reliable, connection oriented. NCP (Network Core Protocol) is used by the file system.

The packet format used by IPX is important as it is key to routing packets from host to host across several intervening networks. Note in the diagram at right that each packet contains both source and destination addresses. That is typical of connectionless protocols and allows each to take a different route when multiple paths exist. The data portion of the packet generally contains the message from higher layers (SPX, NCP).

The application layer SAP (Service Advertising Protocol) serves to inform clients what servers are available and services offered. These are forwarded across routers to other LANs on the internetwork.

1.5.2, 1.5.3, 1.5.4  ARPANET/NSFNET/Internet

The original design was rumored to be for continued communication in the face of serious network failure, such as in war. Regardless, the design is very robust, having decentralized control and multiple paths between hosts. Remarkably, the design has also proven efficient and adaptable. While not a particularly clean design (i.e. the distinction between the layer and interface is not always clear) it is the most common networking protocol.

One key to the great acceptance of the Internet protocols (defined in RFCs) is its lack of a specification for how the physical and data link layers are to operate. The physical layer can consist of cans and strings as long a an IP packet can be transmitted. It is also public and free, much was developed by poor, underpaid students (for much of the original TCP/IP protocol and later Web development).

A typical (somewhat similar to the IUS and IU network) network consists of LANs joined by a communications subnet through routers and gateways as in the diagram at right. The subnet itself consists of communication lines and IMPs (Interface Message Processors). The job of an IMP is to communicate with other IMPs, passing host packets toward the destination address, and managing the network (detecting network failures and rerouting around them, etc.). The fact that all network traffic is carried in datagrams allows rerouting, in a connection-oriented subnet, a failure could break the connection which would have to be reestablished through a different path.

Visit www.internic.net for information on obtaining your own Internet domain name.

1.6 Example Data Communication Services

The text discusses several common methods of transmitting bits, mostly over public networks. The protocols discussed are only concerned with transmitting bits from point A to point B, not with what the end hosts do with the bits. Frame relay and ATM are popular now or growing in use, ATM is examined in more detail in Chapter 2 so that section should be read carefully.

1.6.3 Frame relay

With reliable digital connections and inexpensive computers, it addresses the need for a simple, bare-bones communications protocol that shifts more of the burden to the end hosts. Essentially a virtual leased line between two points (possibly to join two distant LANs) that can send frames (packets) across the network. The virtual line is in reality shared with other users so the maximum data rate of a burst is the limit of the network but the average rate must be below some predetermined service average. With a physical leased line, the entire line is leased and is always fully available, this is obviously more expensive than the virtual line. The maximum packet size is 1600 bytes with a 10-bit virtual circuit number for addressing (routing). The data rate is about 1.5 Mbps.

1.6.4 Broadband ISDN and ATM

It should be noted that ATM has not been accepted as quickly as expected and is likely to have stiff competition in the key areas of video and audio transmission from improved TCP/IP. IP Version 4 (IPV4) is slowly being replaced by a more capable IP Version 6, discussed later in the course.


Document last modified: