What is

364
1.What is .NET Framework? The .NET Framework isthe foundation on which you can design, develop, and deploy applications. It is the core of the .NET infrastructure. It exists as a layer between the .NET applications an the underlying operating system. The .NET Framework encapsulates much of the basic functionality, such as debugging and security services, which was earlier built into various programming languages. 2. What does .NET Framework consists of? The .NET Framework consists ofWeb forms, Windows forms, and console applications that pertain to the presentation layer of an application. forms are used in Web-based applications, whereas Windows Forms are used in Windows-based applications for providing an interactive user interface. In addition, you can create character-based console applications that can be executed from the command line. Besides these three components, the .NET Framework consists of two other components, the .NET Framework Base Classes and the Common Language Runtime (CLR). 3. Write a note on: a. Programming methodologies The Visual Studio.NET programming methodologyallows for mixed- language programming. This is established through a Common Type System (CTS) that is de ned for all the languages that .NET Framework supports. All these languages compile into an intermediate language

description

4

Transcript of What is

1. What is .NET Framework?The .NET Framework is the foundation on which you can design, develop, and deploy applications. It is the core of the .NET infrastructure. It exists as a layer between the .NET applications and the underlying operating system. The .NET Framework encapsulates much of the basic functionality, such as debugging and security services, which was earlier built into various programming languages.

2. What does .NET Framework consists of?The .NET Framework consists of Web forms, Windows forms, and console applications that pertain to the presentation layer of an application. Web forms are used in Web-based applications, whereas Windows Forms are used in Windows-based applications for providing an interactive user interface. In addition, you can create character-based console applications that can be executed from the command line. Besides these three components, the .NET Framework consists of two other components, the .NET Framework Base Classes and the Common Language Runtime (CLR).

3. Write a note on:

a. Programming methodologies

The Visual Studio .NET programming methodology allows for mixed-language programming. This is established through a Common Type System (CTS) that is defined for all the languages that .NET Framework supports. All these languages compile into an intermediate language before they compile in native code. Therefore, the .NET developer has the independence to code one module of an application in one language and the other module of the same application in another language.

b. Platform technologies

The .NET Framework includes platform technologies like ADO.NET, ASP.NET, and VB.NET. ADO.NET allows .NET applications to communicate with a database for retrieving, accessing, and updating data. ASP.NET is a framework for building enterprise-class Web applications. VB.NET is an object-oriented language that provides features such as abstraction, encapsulation, and polymorphism. By using these technologies, you can easily develop robust Web applications, Windows applications, and XML Web services.

c. Code execution

The code execution process involves the conversion of Intermediate Language into native orCPU-specific code. The CLR is completely architecture-neutral. All the .NET languages get compiled into the IL. This intermediate language gets compiled by Just-in-Time (JIT) compiler into the native machine code. After translating the IL into native code, the converted code is sent to the .NET runtime manager. The .NET runtime manager executes the code. While executing the code, a security check is performed to ensure that the code has the appropriate permissions for accessing the available resources

4. Which are the platform technologies supported by .NET Framework?Some of the platform technologies supported by .NET Framework are:n ADO.NET , ASP.NET ,VB.NET6. What is backward compatibility?

Backward compatibility refers to the ability of a technology to work with its previous versions or with other earlier technologies. For example, the Active Directory structure of Windows 2000 is backward compatible with Windows NT 3.51 and 4.0. Similarly, the .NET Framework supports backward compatibility. For example, you can compile and run applications created in Visual Basic 6.0 in Visual Studio 2005.

7. Does .NET platform support backward compatibility? Explain.

The .NET platform supports backward compatibility. It is possible for an application compiled in one version of the .NET Framework to run on a different version of the .NET Framework. For example, you can run applications developed in Visual Studio 2002/2003 on Visual Studio 2005.

In addition to the above example, the .NET platform supports backward compatibility in the following ways:

The .NET Framework 2.0 BCL supports backward compatibility with the earlier versions. .NET supports C++ because of backward compatibility. To run a C++ code on .Net Framework, you need to include the following line at the beginning of the code:

#using

VB applications can work on VB.NET and ASP applications can run on ASP.NET because of backward compatibility. You can easily reference COM components in.NET applications.

1. What are the different types of application architectures? Or modified architecture layout.of .NET framework.

The different types of application architectures are:

Single-tier: A single application handles all functions related to the user, business, and data service layers. Such an application is also called a monolithic application.

Two-tier: The two-tier architecture divides an application into the following two components:

Client: Implements the user interface

Server: Stores data The business logic can either be integrated with the client (fat client) or with the server (fat server).

Three-tier: In the case of three-tier architecture, all the three service layers reside separately, either on the same machine or on different machines. The user interface interacts with the business logic. The business logic validates the data sent by the interfaces and forwards it to the database if it conforms to the requirements. The front-end only interacts with business logic, which, in turn, interacts with the database.

n-tier: An n-tier application uses business objects for handling business rules and data access. It has multiple servers handling business services. This application architecture provides various advantages over other types of application architectures. Some of the advantages include extensibility, resilience to change, maintainability, and scalability of the application

5. List the advantages of .NET Framework.The .NET Framework offers the following advantages:Consistent programming model: The base classes of the .NET class library provide standard functionality such as, input/output, remoting, thread management, string manipulation, user interface design, and security management. The ADO.NET classes allow developers to access data in the form of XML. XML classes enable developers to read, write, manipulate, and transform XML files. The ASP.NET classes support the development of Web-based applications and Web services. The Windows forms classes support the development of desktop-based applications. Together, the .NET class library provides a common functionality to all .NET languages resulting in a consistent object model regardless of the programming language used by the developer.n Language independence: The .NET developer has the independence to code one module of an application in one language and the other module of the same application in another language. This language interoperability can help in code reuse, and improve the efficiency of the development process.

n Ease of application deployment: The .NET Framework manages the details of locating and loading the components required by an application, even if several versions of the same application exist on the computer. The .NET Framework ensures that all the components on which the application depends are available on the computer before the application begins to run. Visual Studio 2005 includes a new application deployment technology known as ClickOnce, which allows you to easily deploy a Windows forms application. ClickOnce enables you to create desktop applications that are deployed with a secure and system-controlled installation.

n Improved security: The .NET Framework provides several mechanisms for protecting resources and code from unauthorized users:

Code Access Security (CAS) uses permissions to control the code accessing protected resources and operations. Role-based security provides information needed to make decisions about user permissions.n Support for Web services: With the advent of .NET technology, Web services provide many built-in BCL facilities that allow different applications from different sources to communicate with each other. Web services do not provide the user with a GUI. Web services instead share business logic, data and processes through a programmatic interface across a network.

n Ease of creating dynamic Web content: Dynamic Web content is easier to create with .NET. ASP. NET 2.0 includes various features that enable you to easily develop Web applications having a consistent layout and appearance.

n Visual Studio .NET: Visual Studio .NET is the Microsoft application and interface for programming in .NET. Visual Studio .NET provides all the programming advantages mentioned so far. This development environment has an extensive set of ready-to use-controls, good debugging facilities, easy and simple programming features, and a vast set of .NET base classes. All these features enable you to develop high performance applications in a short period of time.

2. What is the difference between a project and a solution?

In Visual Studio .NET, an application can be made up of one or more items, such as files and folders. To organize these items efficiently, Visual Studio .NET has provided two types of containers, projects and solutions.A project typically contains items that are interrelated. Items can be forms, references, and data connections. For example, you may create a project that contains a form for accepting user details and database connection for transferring these details to a database. A project allows you to manage, build, and debug the items that make up an application. When you build a project, it usually results in the creation of an executable file (.exe) or a dynamic link library (.dll). These files that are created as a result of building the project are called the project output.A solution usually acts as a container for one or more projects. For example, you may create a solution containing two projects, one for manipulation of data and the other for generation of reports for the sales division of an organization. Thus, a solution allows you to work on multiple projects within the same instance of the Visual Studio .NET IDE. A solution also allows you to specify settings and options that apply to multiple projects.

3. What does the Visual Studio .NET IDE provide?

The Visual Studio .NET IDE provides you with a common interface for developing various kinds of projects for the .NET Framework. The IDE provides you with a centralized location for designing the user interface for the application, writing code, and compiling and debugging the application. The Visual Studio .NET IDE is available to all the programmers who use the languages in the Visual Studio .NET suite.

4. Why is XML used as a common data format to transfer data among applications?

XML is a cross-platform, hardware and software independent markup language. XML allows computers to store data in a format that can be interpreted by any other computer systems. Therefore, XML can be used to transfer structured data between heterogeneous systems. XML is used as a common data interchange format in a number of applications.

5. What is Whidbey?

Whidbey is the code name of Visual Studio 2005, which was released in November 2005.

6. What is an iterative statement? Explain foreach statement with example.Iteration statements repeatedly execute a block of statements. The number of iterations depends on the condition represented by the boolean expression. The block of code will be iterated until the condition is true.Consider the following code:using System;

class TestForeach

{

static void Main()

{

int[] array1 = new int[] {1,2,3,4,5};

foreach (int i in array1)

Console.WriteLine(Value is {0}, i);

}

}

In the above example, the foreach statement iterates through the elements of array1.

1. With a neat diagram, explain the .NET Framework architecture.The .NET Framework is the foundation on which you design, develop, and deploy applications. Down in the bottom of the figure 1.1, we have operating system not only Windows on which .NET works on, there are also implementations that work under Linux. .NET Framework tries to provide an abstraction between application and operation system services. The .NET common language runtime knows how to get those services from the particular operating system. Common language runtime is running on top of operating systems. It is the execution engine in which a .NET programs execute. It also provides memory services and garbage collectionSitting on top of common language runtime is a very large class library. That is the part of .NET which provides all those different platforms technologies that we were talking about in previous chapter. LikeADO.NET to access databases or ASP.NET to write Internet-enabled software. All those services reside in what we call collectively as Framework Base Class Library. Sitting on top of all, is ultimately some programming languages. As mentioned earlier that .NET supports language interoperability and to implement it, Microsoft has created a common language specification. These specifications are rules by which any .NET language has to play. If the application is implemented based on these rules then it can quite freely interoperate with any of the other .NET languages.7. List the different jump statements supported by C#.The different jump statements supported by C# are:n break statementn continue statement

n goto statement

n return statement

n throw statement

8. What are checked and unchecked statements? Give an example.

The checked and unchecked statements are used to control the overflow checking for integer type arithmetic operations and conversions. The checked statement causes all expressions in the checked block to be evaluated in a checked context, and the unchecked statement causes all expressions in the unchecked block to be evaluated in an unchecked context. Checked allows you to raise an exception whenever stack overflow (or underflow) occurs due to type conversion issues. Unchecked will allow you to ignore these exceptions when the C# project is set to raise these types of exceptions.

Consider the following example:

static void Main()

{

int x = Int32.MaxValue;

Console.WriteLine(x + 1); // Overflow

checked {

Console.WriteLine(x + 1); // Exception

}

unchecked {

Console.WriteLine(x + 1); // Overflow

}

}

In the above example, the checked keyword allows you to report the overflow at runtime.

2. List out the .net architecture and its component///objectives of the .NET Framework.The objectives of .NET Framework are:n To provide an object-oriented programming environment and to determine whether object code is stored and executed locally, or executed remotely.n To provide a code-execution environment that minimizes software deployment and versioning conflicts.

n To provide a code-execution environment that guarantees safe execution of code, including code created by an unknown or semi-trusted third party.

n To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments.

n To ensure consistency across varying types of applications, such as Windows-based applications and Web-based applications.

n To build all communication on industry standards to ensure that code based on the .NET Framework can integrate with any other code.

3. How is Windows Programming different from .NET Programming.

In Windows Programming, the application programs call Windows API function directly. The applications run in the Windows environment, that is, the operating system itself. These types of applications are called unmanaged or unsafe applications.

In .NET Programming, the application calls the .NET BCL functions which communicate with the operating system. The applications run in .NET Runtime environment. These types of applications are called managed or safe applications. The .NET Runtime starts code execution, manages threads, provides services, and manages memory.

9. Give an example of lock and using statements.Example of lock statement:static void Main(){

A a = ;

lock(a) {

a.P = a.P + 1;

}

}

In the above code snippet, a block of code obtains a mutual-exclusion lock.

Example of using statement:

static void Main()

{

using (Resource r = new Resource())

{

r.Func();

}

}

In the above code snippet, resources are obtained with the using statement.

5. What are the functionalities of CLR? Give the steps involved in the managed execution process.The CLR has the following functionalities:n The CLR uses metadata to locate and load classes, lay out instances in memory, resolve method invocations, generate native code, enforce security, and set runtime context boundaries.n The CLR automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Automatic memory management eliminates memory leaks as well as some other common programming errors.

n The CLR makes it easy to design components and applications whose objects interact across languages. Objects written in different languages can communicate with each other, and their behaviors can be tightly integrated.

The managed execution process includes the following steps:

1.Choosing an appropriate language compiler.

2.Compiling your code to MSIL or simply IL: Compiling translates your source code into IL and generates the required metadata.

3.Compiling IL to native code: At execution time, a JIT compiler translates the IL into the native machine code. During this compilation, the code must pass a verification process that examines the IL and metadata to find out whether the code can be determined to be type safe.

4.Executing code: The CLR provides the environment that enables execution as well as a variety of services that can be used during execution.

6. What are assemblies? What are static and dynamic assemblies?

Assembly is a basic element of packaging in .NET. An assembly consists of IL code, metadata that describes what is in the assembly, and any other files or information that the application needs to run, such as graphics and sound files.

Assemblies can be static or dynamic. Static assemblies can include .NET types (interfaces and classes), as well as required resources for the assembly (bitmaps, JPEG files, resource files, and so on). Static assemblies are stored on disk in Portable Executable (PE) files. Dynamic assemblies are the ones that run directly from the memory, and are not saved on disk before execution. They can be saved on the disk after they have been executed

7. How does the .NET execution environment with application domain differ from the traditional way of execution?In the case of .NET Framework, application domains provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications. Several application domains can be run in a single process with the same level of isolation that would exist as separate processes, but without incurring the additional overhead of making IPC calls or switching between processes.Traditionally, the process boundaries have been used to isolate applications running on the same computer. Each application is loaded into a separate process, which isolates one application from another applications running on the same computer. The applications are isolated to provide process security. As a result, the process cannot make direct calls to another process. Instead, IPC techniques have to be used to have communication between the processes. Each application is a separate process9. Write a note on metadata.

An assembly stores all the information about itself. This information is called metadata and includes the name and version number of the assembly, security information, information about the dependencies, and a list of the files that constitute an assembly. Metadata is the binary information describing the program.

When we compile our code into a PE file, the metadata is inserted into one portion of the PE file, while the code is converted to IL and inserted into another portion of the PE file. Every type member that are defined or referenced in a module is described within metadata. When code is executed, the runtime loads metadata into memory and refers it to get information about the codes classes, members, inheritance, and so on. Metadata allows .NET languages to describe themselves in a language-neutral manner. It gives required information to the CLR to perform much of its functionalities. The presence of metadata makes the assembly self-describing file. The CLR modules or components or other assemblies which want to communicate with each other use this information stored in metadata to perform their tasks.

1. What is BCL?

The BCL is an object-oriented library of pre-packaged functionality.

2. What is the difference between managed code and managed data?

The code that targets the functionalities of the CLR is known as the managed code. C#, VB.NET, and Jscript.NET code is managed by default. However, C++ code is not managed by default.

Managed data refers to the data that is allocated and deallocated by the garbage collection feature of the CLR.

8. What is the function of CTS? Explain the classification of types in CTS with the help of a diagram.The CTS defines how types are declared, used, and managed in the runtime. It is important for language interoperability. The CTS performs the following functions:n Establishes a common framework that enables cross-language integration, type safety, and high performance code execution.

n Provides an object-oriented model.

n Defines rules that languages must follow, so that different languages can interact with each other.

CTS can be classified into:

Value types

Reference types The following diagram illustrates type classification.

Value types directly store data in the variable. Value types can be built-in type, user-defined types, or enumerations. Reference types store a reference to the datas memory address. Reference types can be self-describing types, pointer types, or interface types. Self-describing types are further split into arrays and class types. The class types are user-defined classes, boxed value types, and delegates.

All types derive from the System.Object base type.

Consider another program, in which the fibonacci series is generated till 21:using System;namespace ConsoleApplication1{

class fibSeries

{

static void Main()

{

int x=0;

int y=1;

int z=x+y;

Console.WriteLine(x);

Console.WriteLine(y);

Console.WriteLine(z);

while(z!=21)

{

x=y;

y=z;

z=x+y;

Console.WriteLine(z);

}

Console.ReadLine();

}

}

}

Consider another program, which checks if the entered number is a palindrome or not:

using System;

namespace ConsoleApplication1

{

class PalEx

{

public static void Main()

{

int n,num,digit,sum=0,rev=0;

string s;

Console.WriteLine(Please enter a number);

s=Console.ReadLine();

num=Int32.Parse(s);

n=num;

do

{

digit=num%10;

sum+=digit;

rev=rev*10+digit;

num/=10;

}while(num!=0);

Console.WriteLine(Sum of the digit of the number = {0},sum);

Console.WriteLine(Reverse of the number = {0},rev);

if(n==rev)

Console.WriteLine(The number is a palindrome);

else

Console.WriteLine(The number is not a palindrome);

Console.Read();

}

}

3. What is the difference between an assembly and a namespace?An assembly is a single deployable unit that contains all the information about the implementation of classes, structures, and interfaces. Namespaces help you create logical groups of related classes and interfaces that can be used by any language targeting the .NET Framework.4. What is GAC?When you create an assembly, it can be accessed by only the local application that created it. However, multiple applications might require accessing the same assembly. In such situations, you need to store the assembly at a central location. This is done by adding the assembly to the Global Assembly Cache (GAC). GAC is a machine-wide code cache that is used to store assemblies that are created to be shared by multiple applications. You need to assign a strong name to the assemblies before adding it to the GAC.

An assembly can be added to the GAC by using the following methods:

n Using the Windows installer. (The installer used must be compatible with the GAC.)

n Using the Gacutil.exe that is the GAC tool.

n Using the Windows drag and drop feature.

5. Differentiate between a .dll and a .exe.

A .dll runs in the same memory process as the container. This means that if the .dll is corrupted, it will cause the parent application to crash. An .exe on the other hand runs in a different memory process. This means that even if the .exe gets corrupted, the parent application will not be harmed. However, execution of an .exe is slower as compared to .dll.

6. In which file are the assembly details like assembly name and version number stored?

AssemblyInfo.cs

1. List out the important features of C#.

The features of C# are as follows:

C# is an elegant, simple, type-safe, object-oriented language.

C# has the capability to build durable system-level components due to the following features:

Full COM/platform support for existing code integration

Robustness through garbage collection and type safety

Security provided through good design

Full support of extensible metadata concepts

C# supports language interoperability and platform independence.

Chapter Three C# Language TourFeatures of Visual C# .NETVisual C# .NET 2003 allows you to create XML Web services and application for Windows and the Web. The features of Visual C# .NET 2003 are as follows:n Interoperability: You can easily integrate existing applications and components.

n Component-oriented language: C# supports properties, delegates, indexes, arrays, attributes, inheritance, XML Web services, and many more features.

n Application development environment: The Visual C# .NET 2003 IDE provides a complete application development environment that helps create applications easily and quickly.

Microsoft has recently launched Visual C# .NET 2005. Visual C# .NET 2005 includes various enhanced and new features that cut down development time and increase productivity. One such feature is the C# refactoring tool. The C# refactoring tool includes tools that automate many common code refactoring tasks. You can easily rename classes, properties, and methods, extract code, reorder or delete parameters, promote a local variable to be a parameter, encapsulate fields, and perform many other refactoring tasks.

Sample C# Programs

Consider the following program, in which two numbers are added:

using System;

namespace ConsoleApplication1

{

class Add

{

static void Main()

{

7int num1, num2, sum;

System.Console.WriteLine(Enter the first number);

string s1 =Console.ReadLine();

num1=int.Parse(s1);

System.Console.WriteLine(Enter the second number);

string s2 =Console.ReadLine();

num2=int.Parse(s2);

sum=num1+num2;

System.Console.WriteLine(Sum: {0}, sum);

Console.Read()

}

}

}

10. It is told that if we learn any one .NET language, then working with other .NET languages will be easy. How? Explain with an appropriate example.It can be told that if you have learned any one .NET language, then working with other .NET languages will be easy. This is because all the .NET languages rely on the same managed classes of BCL for the same services. The same classes, methods, parameters, and types are used for all the system services regardless of any .NET language.Let us look at the following code that writes to and then reads from a file:// Program in C#

using System;

using System.IO;

static public void Main()

{

StreamWriter sw1=new StreamWriter(temp.txt, true);

string tempstring=Hi, this is Gopal;

sw1.WriteLine(tempstring);

sw1.Close();

StreamReader sr1=new StreamReader(temp.txt);

string filestring=sr1.ReadToEnd();

sr1.Close();

Console.WriteLine(filestring);

}

// Program in VB.NET

shared public sub Main()

dim sw1 as StreamWriter=new StreamWriter(temp.txt, true)

dim tempstring as string= Hi, this is Gopal

sw1.WriteLine(tempstring)

sw.Close()

dim sr1 as StreamReader=new StreamReader(temp.txt)

dim filestring as string=sr1.ReadToEnd()

sr1.Close()

Console.WriteLine(filestring)

end sub

If we see, both versions of the above program are nearly identical. The syntax and use of StreamReader, StreamWriter, and the Console class are identical, same methods, and identical parameters.

2. Write a program in C# to display Welcome to the world of C Sharp. Explain the program.The C# program is as follows:using System;namespace ConsoleApplication1

{

class Welcome

{

static void Main()

{

System.Console.WriteLine(Welcome to the world of C Sharp);

Console.Read();

}

}

}

The important points to be noted in this program are:

Main method: Program execution begins with the Main method.

Input and output: The WriteLine function displays the string on the standard output device.

Compilation and execution: To compile the program, enter the following command:

csc Welcome.cs

To execute the program, enter the following command:

Welcome

1. Can you use the using statement with multiple objects?

You can use the using statement with multiple objects by nesting using statements, as shown in the following code snippet:

using (object1);

using (object2);

Consider the following code snippet:

using (StreamWriter w1 = File.CreateText(SW1)){using (StreamWriter w2 = File.CreateText(SW2)){// code here}}

You can simplify the above code by writing:

using (StreamWriter w1 = File.CreateText(SW1))using (StreamWriter w2 = File.CreateText(SW2)){// code here}

The above code snippet illustrates the use of nested using statements.

3. Explain the general structure of a C# program.C# program can consist of one or more files. Each file can contain one or more namespaces. A namespace contains group of related types such as classes, structs, interfaces, enumerations, and delegates. Namespaces may be nested. The following is the structure of a C# program that contains all of these elements:using System; //Using the System Namespacenamespace Namespace1 //Defining a namespace

{

class Class1 //Defining a class

{

}

struct Struct1 // Defining a structure

{

}

interface Interface1 //Defining an interface

{

}

delegate int Delegate1();

enum Enum1 //Defining an enumeration

{

}

namespace Namespace2 //Defining a namespace

{

}

class Class2 //Defining a class

{

public static void Main(string[] args) //Program execution begins //from here

{

}

}

}

4. How do namespaces and types in C# have unique names? Give an example.

Namespaces and types always have unique names. If there are two classes with the same name but present in different namespaces, then both the objects will have unique fully qualified names. Consider the following code snippet:

namespace ABC // ABC

{

class Class1 // ABC.Class1

{

}

}

namespace XYZ // XYZ

{

class Class1 // XYZ.Class1

{

}

}

Here the ABC.Class1 and XYZ.Class1 are two different types, even if the class name is same.

5. List out the difference between C# and C++.The differences between C# and C++ are as follows.n C# is purely object-oriented language, whereas C++ support object-oriented programming.n Arrays: The syntax of declaring C# arrays is different from that of C++ arrays. The tokens []

appear following the array type in C#.

n The bool type in C#: There is no conversion between the bool type and int.

n The long type: In C#, the long data type is 64 bits, while in C++, it is 32 bits.

n The struct type: In C#, classes and structs are semantically different. A struct is a value type,

while a class is a reference type.

n The switch statement: Unlike the C++ switch statement, C# does not support fall through from

one case label to another.

n The delegate type: Delegates are roughly similar to function pointers in C++, but they are typesafe

and secure.

n Preprocessor directives are used for conditional compilation. No header files are used in C#.

n C# operators: C# supports additional operators such as is and typeof. It also introduces different

functionality of some logical operators.

n The Main method is declared differently from the main function in C++. The usage of th

10. How are structures different from classes in C#?Structures are value types and classes are reference type. A variable of a structure type directly contains the data of the structure, whereas a variable of a class type contains a reference to the object. You can inherit classes but you cannot inherit structures.11. What are interfaces? Give an example.Interfaces are used to define a contract; a class or struct that implements the interface must obey to this contract. Interfaces can contain methods, properties, indexers, and events as members. They cannot contain constants, fields (private data members), constructors, and destructors, or any type of static member. All the members of an interface are public by definition.

Consider the following example:

interface IExample

{

string this[int index] { get; set; }

event EventHandler E;

void Func(int value);

string P { get; set; }

}

public delegate void EventHandler(object sender, EventArgs e);

The above example shows an interface that contains an indexer, an event E, a method Func, and a property P.

Jump Statements

Jump statements allow you to easily transfer control from one branch of the program to another. Following are some of the jump statements:

n break: This statement is used to terminate from a loop or a switch statement. Control is passed to the statement following the terminated statement. In the following example, the break statement terminates the loop after five counts:

class BreakEx

{

static void Main()

{

for (int ctr = 1; ctr Monoalphabetic Ciphers

3>Playfair Cipher

4> Hill cipher

5>Transposition Ciphers Example of the

10. Briefly explain the WLAN protocol architecture.In a typical WLAN setup, the IEEE 802.11 standard WLAN (Access Point) gets connected to an IEEE 802.3 standard Ethernet (Switch/HUB) via a bridge. The higher layers (application, TCP, IP) look the same for the wireless node as for the wired node. The IEEE 802.11 standard only covers the physical layer (PHY) and medium access layer (MAC) like the other 802.x LANs do. The physical layer is sub divided into the Physical Layer Convergence Protocol (PLCP) and the Physical Medium Dependent Sub Layer.The basic tasks of the MAC layer comprise medium access, fragmentation of user data, and encryption. The PLCP sublayer provides a carrier sense signal called Clear Channel Assessment (CCA), and provides a common PHY interface for the MAC, which is independent of the transmission technology.11. Write a note on DSSS.

Direct Sequence Spread Spectrum (DSSS) is the alternative spread spectrum method, in which the signal is spread over a wide range of frequencies using a chipping code. In the case of IEEE 802.11 DSSS, spreading is achieved by using the 11-chip sequence (+1,-1,+1,+1,-1,+1,+1,+1,-1,-1,-1), which is also called the Barker code.

2. What are radio waves?

Radio waves are electromagnetic radiations that have the lowest frequency, the longest wavelength, and are produced by charged particles moving back and forth. The atmosphere of the earth is transparent to radio waves with wavelengths from a few millimeters to about 20 meters.

6. What is Steganography?

Ans. Stenography hides the message (secrete) in other messages. Generally the sender writes an innocuous message and then conceals a secret message on the same piece of paper. Historical tricks include invisible inks, tiny pin punctures on selected characters, minute differences between handwritten characters, pencil marks on typewritten character, grilles which cover most of the message except for a few characters and so on.

Some examples are listed below:

A few examples of steganography are:

n Character marking: Selected letters of printed or type written text are overwritten in pencil. The marks are ordinarily not visible unless the paper on which text is printed or type written is held at an angle to bright light.

n Invisible ink: A number of substances can be used for writing but the ink leaves no visible trace until heat or a specific chemical is applied to the paper.

n Pin punctures: Small pin punctures on selected letters are ordinarily not visible unless the paper is held up in front of a light.

Typewriter correction ribbon: This is a black ribbon used between typed lines typed. The results of typing with the correction tape are visible

CHAPTER THREE

RTSP

The RTSP is a client-server application-level protocol that controls the delivery of data with real-time properties. RTSP establishes and controls either a single or several time-synchronized streams of continuous media, such as audio and video. RTSP uses the transport protocols such as User Datagram Protocol (UDP), multicast UDP, Transmission Control Protocol (TCP), and Real-Time Transport Protocol (RTP) to deliver the continuous streams. It acts as a network remote control for multimedia servers. Sources of data can include both live data feeds and stored clips.

Q. Explain the why audio and video need to be compressed?

Ans: Raw Audio and Video samples after digitization occupy a large amount of space. Therefore audio and video are compressed before being sent through the network. The need for digitization is obvious: computer networks transmit bits, so all transmitted information must be represented as a sequence of bits. Compression is important because uncompressed audio and video consume a tremendous amount of storage and bandwidth.n only in good light.

4. Briefly explain security mechanisms.

Mechanisms that ensure security of an organization are known as security mechanisms. Encryption or encryption like transformations of information is the most common means of providing security.

There are certain common information integrity functions to secure network/data like identification, validation, authorization, time of occurrence, signature, authenticity, concurrence, ownership, receipts, registration, endorsement, privacy, access, and endorsement.

Q. Explain anyone algorithm for routing?

Ans: The Shortest Path First (SPF) routing algorithm is the basis for OSPF operations. When an SPF router is powered up, it initializes its routing-protocol data structures and then waits for indications from lower-layer protocols that its interfaces are functional. After a router is assured that its interfaces are functioning, it uses the OSPF Hello protocol to acquire neighbors, which are routers with interfaces to a common network. The router sends hello packets to its neighbors and receives their hello packets. In addition to helping acquire neighbors, hello packets also act as keepalives to let routers know that other routers are still functional. On multiaccess networks (networks supporting more than two routers), the Hello protocol elects a designated router and a backup designated router. Among other things, the designated router is responsible for generating LSAs for the entire multiaccess network. Designated routers allow a reduction in network traffic and in the size of the topological database.

Q. What is packet Jiter .

Ans:- A crucial component of end-to-end delay is the random queuing delays in the routers. Because of these varying delays within the network, the time from when a packet is generated at the source until it is received at the receiver can fluctuate from packet to packet. This phenomenon is called jitter. As an example, consider two consecutive packets within a talk spurt in our Internet phone application. The sender sends the second packet 20 msec after sending the first packet.

Q. Explain the playfair cipher OR Explain anyone cryptographic algorithm with suitable example.

Ans:- Playfair Cipher

The well known multiple letter encryption cipher is the playfair, which treats diagrams in the plaintext as single units and translates these units into ciphertext diagrams. The playfair algorithm is based on the use of a 55 matrix of letters constructed using a keyword.

Plaintext is encrypted two letters at a

time, according to the following rules:

1. Repeating plaintext letters that would fall in the same pair are separated with a filler letter, such as x, so that bolloon would be enciphered as ba lx lo on.

2. Plaintext letters that fall in the same row of the matrix are each replaced by the letter to the right, with first element of the row circularly following the last. For example, ar is encrypted as RM.

3. Plaintext letters that fall in the same column are each replaced by the letter beneath, with the top element of the row circularly following the last. For example, mu is encrypted as CM.

4. Otherwise, the letter that lies in its own row replaces each plaintext letter and the column occupied by the other plaintext letter. Thus, hs becomes BP and ea becomes IM(or JM, as the encipherer wisher).

The palyfair cipher is a great advance over simple monoalphabetic ciphers.

Transposition Ciphers

In a transposition cipher the plaintext remains the same, but the order of characters is shuffled around. In a simple columnar transposition cipher, the plaintext is written horizontally onto a piece of graph paper of fixed width and the ciphertext is read off vertically seen the following example. Decryption is a matter of writing the ciphertext vertically onto a piece of graph paper of identical width and then reading the plain text off horizontally.

Plaintext: COMPUTER GRAPHICS MAY BE SLOW BUT AT LEAST ITS

EXPENSIVE

COMPUTERGR

APHICSMAYB

ESLOWBUTAT

LEASTITSEX

PENSIVE

Ciphertext: CAELPOPSEEMHLANPIOSSUCWTITSBIVEMUTERATSGYAERBTX

Q. What is cryptography? Give the model of internet security.

Ans: Cryptography : Cryptography is the science of using mathematics to encrypt and decrypt data. Cryptography enables us to store sensitive information or transmit it across insecure networks (like the Internet) so that it cannot be read by anyone except the intended recipient. Cryptography is the science of securing data, whereas the cryptanalysis is the science of analyzing and breaking secure communication.

Model of Internet security: A message is to be transferred form one

party to another across some sort of Internet. The two parties, who are the principals in this transaction, must cooperate for the exchange to take place. A logical information channel is established by defining a route through the Internet from source to destination and by the cooperative use of communication protocols

by the two principals.

Model for network security

(i) A security-related transformation on the information to be sent.

(ii) Some secret information shared by the two principals and it is hoped, unknown to the opponent.

Q. What is streaming?

Ans: Streaming:In a streaming stored audio/video application, a client begins playout of the audio/video of few seconds after it begins receiving the file from the server. This means that the client will be playing out audio/video from one location in the file while it is receiving later parts of the file from the server. This technique, known as streaming, avoids having to download the entire file (and incurring a potentially long delay) before beginning playout. There are many streaming multimedia products, such as RealPlayer, QuickTime and Media Player.

11. Explain how does the helper application get data from a streaming server.

Getting data from streaming server to helper application like the media player requires at least two servers where data is placed. One server is the HTTP server, and the second server is the streaming server.

For example, when a user visits any songs/news web site, the web browser communicates with the web server where the user chooses the file that has music or news. The moment the user clicks any media file; media player requests for the media file to the streaming server and user receives the media file on the media player

9. What are the limitations of the best effort service? Explain.

Limitations of the best effort service are:

n Packet loss: As a IP datagram crosses through a network over UDP, it passes through buffers in the routers in order to access outbound links. It is possible that one or more of the buffers in the route from sender to receiver is full and cannot admit the datagram. In this case, the IP datagram is discarded, never to arrive at the receiving application. Loss could be eliminated by sending the packets over TCP rather than over UDP.

n Excessive end-to-end delay: End-to-end delay is the accumulation of transmission, processing, and queuing delays in routers, propagation delays in the links, and end-system processing delays.

n Packet jitter: A crucial component of end-to-end delay is the random queuing delays in the routers. Because of these varying delays within the network, the time from when a packet is generated at the source until it is received at the receiver can fluctuate from packet to packet. This phenomenon is called jitter.

9. What are the limitations of the best effort service? Explain.

Limitations of the best effort service are:

n Packet loss: As a IP datagram crosses through a network over UDP, it passes through buffers in the routers in order to access outbound links. It is possible that one or more of the buffers in the route from sender to receiver is full and cannot admit the datagram. In this case, the IP datagram is discarded, never to arrive at the receiving application. Loss could be eliminated by sending the packets over TCP rather than over UDP.

n Excessive end-to-end delay: End-to-end delay is the accumulation of transmission, processing, and queuing delays in routers, propagation delays in the links, and end-system processing delays.

n Packet jitter: A crucial component of end-to-end delay is the random queuing delays in the routers. Because of these varying delays within the network, the time from when a packet is generated at the source until it is received at the receiver can fluctuate from packet to packet. This phenomenon is called jitter.

12. Explain RTSP.

RTSP is a protocol that enables a media player to control the transmission of a media stream. RTSP messages use the port number 544 from the media stream. The RTSP specification, RFC 2326, permits RTSP messages to be sent over TCP or UDP.

RTSP server keeps a track of the state of the client for each ongoing RTSP session. For example, the server keeps track of whether the client is in an initialization state, a play state, or a pause state. The session and sequence numbers, which are part of each RTSP request and response, help the server to keep track of the session state. The session number is fixed throughout the entire session; the client increments the sequence number each time it sends a new message; the server echoes back the session number, and the current sequence number.

8. What is a streaming server?Streaming servers are meant for the audio/video streaming applications. Upon client request, a server directs an audio or a video file to the client by sending the file into a socket. Both the TCP and UDP socket connections are used. Before sending the audio/video file to a network, the file is segmented, and the segments are typically encapsulated with special headers appropriate for audio and video traffic.Streaming servers send digital video for news, entertainment, or educational content over the Internet by using RTP/RTSP. A multimedia file gets uploaded on the server and streaming servers encodes content in the latest media formats including MPEG- 4 (Moving Picture Expert Group) and the AAC (Advanced Audio Coder) audio.6. Why do audio and video file need to be compressed?

Compression is required to reduce the size of audio and video so that they can be easily transmitted over the Internet.

For example, a single image consisting of 1024 pixel * 1024 pixels, with each pixel encoded into 24 bits requires 3 MB of storage without compression. There are eight bits, three each for the colors red, green, and blue. It would take approximately seven minutes to send the image over a 64 kbps link. If the image is compressed at a modest 10:1 compression ratio, the storage requirement is reduced to 300 Kbytes and the transmission time also drops by a factor of 10.

Q. With neat diagram explain RTP2 packet format?

Ans: The RIP 2 specification (described in RFC 1723) allows more information to be included in RIP packets and provides a simple authentication mechanism that is not supported by RIP.

CommandIndicates whether the packet is a request or a response. The request asks that a router send all or a part of its routing table. The response can be an unsolicited regular routing update or a reply to a request. Responses contain routing table entries. Multiple RIP packets are used to convey information from large routing tables.

VersionSpecifies the RIP version used. In a RIP packet implementing any of the RIP 2 fields or using authentication, this value is set to 2.

UnusedHas a value set to zero.

Address-family identifier (AFI)Specifies the address family used. RIPv2s AFI field functions identically to RFC 1058 RIPs AFI field, with one exception: If the AFI for the first entry in the message is 0xFFFF, the remainder of the entry contains authentication information. Currently, the only authentication type is simple password.

Route tagProvides a method for distinguishing between internal routes (learned by RIP) and external routes (learned from other protocols).

IP addressSpecifies the IP address for the entry.

Subnet maskContains the subnet mask for the entry. If this field is zero, no subnet mask has been specified for the entry.

Next hopIndicates the IP address of the next hop to which packets for the entry should be forwarded.

MetricIndicates how many internetwork hops (routers) have been traversed in the trip to the destination. This value is between 1 and 15 for a valid route, or 16 for an unreachable route.

Routing Protocols

Routing protocol refers to a protocol that enables routing through implementation of a routing algorithm. A routing algorithm is an algorithm that determines the possible route through which data packets would reach the destination.

Some of the routing protocols are:

n Interior Gateway Routing Protocol (IGRP)

n Cisco Discovery Protocol (CDP)

Hot Standby Router Protocol (HSRP

CDP

CDP is a media and protocol-independent device-discovery protocol that runs on all Cisco-manufactured equipment including routers, access servers, bridges, and switches. By using CDP, a device can advertise its existence to other devices and receive information about other devices on the same Local Area Network (LAN) or on the remote side of a Wide Area Network (WAN).

1. What is routing? Differentiate between the two types of routing, direct routing and indirect routing.

Routing is the process of moving information across an internetwork from a source router to a destination router. Routing occurs at the third layer of the Open System Interconnect (OSI) model, known as the network layer. Routing protocols use metrics to evaluate what path will be the best for a packet to travel.

The differences between direct routing and indirect routing are as follows.

Direct Routing

In direct routing, packet delivery occurs when the source and destination of the packet is located on the same physical network or if the packet delivery is between the last router and the destination host

In direct routing, the address mapping is between the IP address of the final destination and the physical address of the final destination.

A packet delivery always involves one direct routing

Routing ProtocolsRouting protocol refers to a protocol that enables routing through implementation of a routing algorithm. A routing algorithm is an algorithm that determines the possible route through which data packets would reach the destination.Some of the routing protocols are:n Interior Gateway Routing Protocol (IGRP)

n Cisco Discovery Protocol (CDP)

n Hot Standby Router Protocol (HSRP)

Q. Discuss different approaches used to make the routing table more efficient OR Different form of routing.

Ans: Approach used to make the routing table more efficient.

(i) Next hop routing : In this technique the routing table holds only the address of the next hop instead of holding information about the complete route. Routing tables are thereby consistent with each other.(ii) Network specific routing : In this technique instead of having an entry for every host connected to the same physical network, we have only one entry to define the address of network itself.(iii) Host Specific routing: In this routing the host address is given in the routing table. It is a good choice for certain purpose such as checking the route or providing security measure.(iv) Default Routing: This routing is used to simplify routing. In this routing instead of listing all network in the entire internet. Host a can just have one entry called the default.IGRP

IGRP is a distance vector Interior Gateway Protocol (IGP). IGRP mathematically compare routes by using some measurements of distance. This measurement is known as the distance vector. Routers send all or a portion of their routing table in a routing-update message at regular intervals to each of their neighboring routers if the router is using a distance vector protocol. As routing information propagates through the network, routers can identify new destinations as they are added to the network, learn about the failures in the network, and calculate distances to all known destinations.

Indirect Routing

In indirect routing, the packet goes from router to router until it reaches the router connected to the same physical network as its final destination.

\ In an indirect routing, the address mapping is between the IP address of the next router and the physical address of the next router.

A packet delivery may or may not involve indirect routing

RTP

RTP defines a standardized packet format for delivering audio and video over the Internet. It was developed by the audio and video transport working group of the Internet Engineering Task Force (IETF) and first published in 1996 as RFC 1889.

RTP does not have a standard TCP or UDP port from which it communicates. The only standard that it obeys is that UDP communications are done on an even port and the next higher odd port is used for TCP communications. RTP uses UDP and defines format for additional information required by an application such as sequence number and time stamp.

REAL-TIME TRANSPORT CONTROL PROTOCOL (RTCP)

RTCP is the protocol that gathers transmission statistics during the transmission of multimedia data from a streaming server to a client machine. RTCP gathers information such as bytes sent, packets sent, lost packets, jitter, feedback, and round trip delay. To get this information, RTCP monitors data delivery from the streaming server to the receivers machine and enables the receiver to detect if there is any packet loss and compensates for any delay jitter.

RTCP works with RTP in the delivery and packaging of multimedia data but does not transport any data. It also does not provide any flow encryption or authentication means by itself. It is used periodically to transmit control packets to participants in a streaming multimedia session. The primary function of RTCP is to provide feedback on the quality of service being provided by RTP.

SMTPSMTP is a protocol that is used for sending e-mail messages. Whenever a user sends an e-mail by using e-mail clients such as Outlook Express, the client uses SMTP to transfer the e-mail to the mail server.E-mail is routed to an intermediate mail server, which then delivers it to the recipients mail server. For example, a company with several servers has designated one server as a mail gateway to the Internet. Any e-mail sent to the company would arrive at the gateway server, and then be relayed to the appropriate server for delivery to the recipient.However, malicious users sometimes try to perform unauthorized mail relaying. For example, a spammer who has a low-end server and a slow network connection might use mail relaying in order to get other companys higher-powered mail server and a fast network connection to send spam mail on their behalf.

Even worms can use some other server and network to send mass mails. Many worm programs are used today to send mass junk e-mails to disturb networks. Sending mass spam mails is an unlawful activity. The following table lists ports about a few more protocols.

DNS

DNS is an Internet service that translates domain names to IP addresses. Every time you query or use a domain name, a DNS server translates the domain name into its corresponding IP address. The DNS server uses cache to resolve queries. The server cache is a part of the memory that stores the recently accessed information. Caching enables fast responses to the DNS queries. It also reduces network traffic because the DNS server can gather responses for queries from its cache, rather than sending the queries to the other DNS servers.

The DNS server collects and stores all the information that it receives when a query is processed. The server retains this information in the server cache till the specified time-period in the resource record. This time-period is called the time-to-live (TTL) value of the returned record information.

After caching, the TTL value starts decreasing so that the server knows when to delete the resource record. The record is marked for deletion, when the TTL value reaches zero.

Consider an example. An organization has a 1,000 machine setup with a domain controller, three additional domain controllers, and few application servers, such as web servers, database servers, and few file servers. Domain controller is also a DNS server for the organization. Software developers access these servers and other machines for their day-to-day work. They notice that it takes a longer time to access servers and machines with the machine name as compared to the time taken when they access machines with the IP addresses. The reason for this is that the DNS server is loaded and therefore, it slows down while resolving queries. After a query is resolved, the DNS server cache gets deleted. This can be resolved by creating a cache on another DNS server. This will help the DNS server to resolve queries faster.

The TTL value indicates the time for which a DNS client can use a DNS record before deletion of the record or before the record expires. Users can specify the TTL value for a DNS record in seconds.The minimum default value of the TTL for records created by the DNS server is 3600 seconds. A short TTL value results in heavy DNS traffic. A large TTL value causes the server to reply to queries by using outdated resource records.

HSRPHSRP is a routing protocol that provides backup to a router in the event of the failure of the router.

HSRP provides network redundancy for IP networks. It ensures that user traffic recovers immediately and transparently from first hop failures in network edge devices or access circuits.

TIMERS IN RIP

RIP uses three timers to support its operation:

n Periodic Timer: The Periodic timer controls the advertising of regular update messages. Although the protocol specifies that the timer must be set to 30 seconds, the working model uses a random number between 25 and 35 seconds. This is to prevent any possible synchronization and, therefore, prevent overload on the network if the routers update simultaneously. Each router has one periodic timer that is set randomly to a number between 25 and 35 seconds. When the counter reaches zero, the update message is sent to the other routers and the timer is randomly set once again.

n Expiration Timer: The expiration timer checks the validity of a route. When a route receives the update information from the other routers for a specific route, the expiration timer is set to 180 seconds. Every time a new update for the route is received, the timer is reset. In normal situations, this occurs every 30 seconds. However, if there is a problem on the Internet and no update is received within the allocated 180 seconds, the route is considered expired and the hop count of the route is set to 16.

Garbage Collection Timer: When the information about a route becomes invalid, the router does not immediately purge that route from its table. Instead, it continues to advertise the route with a metric value of 16. At the same time, a timer called Garbage Collection Timer is set to 120 seconds for that route. When the count reaches zero, the route is purged from the table. This timer allows the neighboring routers to become aware of the invalidity of a route prior to purging

Q. Discuss an IP RIP packet format.Ans: An IP RIP Packet Consists of Nine FieldsCommandIndicates whether the packet is a request or a response. The request asks that a router send all or part of its routing table. The response can be an unsolicited regular routing update or a reply to a request. Responses contain routing table entries. Multiple RIP packets are used to convey information from large routing tables. Version numberSpecifies the RIP version used. This field can signal different potentially incompatible versions.

ZeroThis field is not actually used by RFC 1058 RIP; it was added solely to provide backward compatibility with pre-standard varieties of RIP. Its name comes from its defaulted value: zero.

Address-family identifier (AFI)Specifies the address family used. RIP is designed to carry routing information for several different protocols. Each entry has an address-family identifier to indicate the type of address being specified. The AFI for IP is 2.

AddressSpecifies the IP address for the entry.

MetricIndicates how many internetwork hops (routers) have been traversed in the trip to the destination. This value is between 1 and 15 for a valid route, or 16 for an unreachable route.

IGRP

IGRP is a distance vector Interior Gateway Protocol (IGP). IGRP mathematically compare routes by using some measurements of distance. This measurement is known as the distance vector. Routers send all or a portion of their routing table in a routing-update message at regular intervals to each of their neighboring routers if the router is using a distance vector protocol. As routing information propagates through the network, routers can identify new destinations as they are added to the network, learn about the failures in the network, and calculate distances to all known destinations.

CDP

CDP is a media and protocol-independent device-discovery protocol that runs on all Cisco-manufactured equipment including routers, access servers, bridges, and switches. By using CDP, a device can advertise its existence to other devices and receive information about other devices on the same Local Area Network (LAN) or on the remote side of a Wide Area Network (WAN).

3. What is a metric? What are some of the metrics used by the routing protocols?

A metric is a standard of measurement, such as path bandwidth, which is used by routing algorithms to determine the optimal path to a destination.

Some of the metrics used by the routing protocols are path length, reliability, delay, bandwidth, load, and communication cost.

OPEN SHORTEST PATH FIRST

Open Shortest Path First (OSPF) is a routing protocol developed for Internet Protocol (IP) networks by the Interior Gateway Protocol (IGP) working group of the Internet Engineering Task Force (IETF).

The working group was formed in 1988 to design an IGP based on the Shortest Path First (SPF) algorithm for use in the Internet. Similar to the Interior Gateway Routing Protocol (IGRP), OSPF was created because in the mid-1980s, the Routing Information Protocol (RIP) was increasingly incapable of serving

large, heterogeneous internetworks. This chapter examines the OSPF routing environment, underlying

routing algorithm, and general protocol components.

OSPF was derived from several research efforts, including Bolt, Beranek, and Newmans (BBNs)

SPF algorithm developed in 1978 for the ARPANET (a landmark packet-switching network developed in OSPF has two primary characteristics. The first is that the protocol is open, which means that its

specification is in the public domain. The OSPF specification is published as Request For Comments

(RFC) 1247. The second principal characteristic is that OSPF is based on the SPF algorithm, which

sometimes is referred to as the Dijkstra algorithm, named for the person credited with its creation.

OSPF is a link-state routing protocol that calls for the sending of link-state advertisements (LSAs) to

all other routers within the same hierarchical area. Information on attached interfaces, metrics used, and

other variables is included in OSPF LSAs. As OSPF routers accumulate link-state information, they use

the SPF algorithm to calculate the shortest path to each node.

As a link-state routing protocol, OSPF contrasts with RIP and IGRP, which are distance-vector routing

protocols. Routers running the distance-vector algorithm send all or a portion of their routing tables inrouting-update messages to their neighbors.

l Prefer the path with the lowest IP address, as specified by the BGP router ID.

An AS can be divided into a number of areas, which are groups of contiguous networks and attached hosts. Routers with multiple interfaces can participate in multiple areas. These routers, which are called Area Border Routers, maintain separate topological databases for each area.

A topological database is essentially an overall picture of networks in relationship to routers. The topological database contains the collection of LSAs received from all routers in the same area. Becauserouters within the same area share the same information, they have identical topological databases.

The term domain sometimes is used to describe a portion of the network in which all routers haveidentical topological databases. Domain is frequently used interchangeably with AS.An areas topology is invisible to entities outside the area. By keeping area topologies separate, OSPF

n ComputerToFind: Looks up for complete information such as DNS name and IP address of a computer system by using the current default DNS name server.

n Server: Specifies to use this server as the DNS name server. If you omit Server parameter, the default DNS name server is used.

SMTP

SMTP is a protocol that is used for sending e-mail messages. Whenever a user sends an e-mail by using e-mail clients such as Outlook Express, the client uses SMTP to transfer the e-mail to the mail server.

E-mail is routed to an intermediate mail server, which then delivers it to the recipients mail server. For example, a company with several servers has designated one server as a mail gateway to the Internet. Any e-mail sent to the company would arrive at the gateway server, and then be relayed

to the appropriate server for delivery to the recipient.

However, malicious users sometimes try to perform unauthorized mail relaying. For example, a spammer who has a low-end server and a slow network connection might use mail relaying in order to get other companys higher-powered mail server and a fast network connection to send spam mail on their behalf.

Even worms can use some other server and network to send mass mails. Many worm programs are used today to send mass junk e-mails to disturb networks. Sending mass spam mails is an unlawful activity. The following table lists ports about a few more protocols.

n RTP/RTCP provides functionality and control mechanisms necessary for carrying real-time content. But RTP/RTCP itself is not responsible for the higher-level tasks like assembly and synchronization. These have to be done at the application level.

Q. Explain the BG P protocol in detail. Ans:The Border Gateway Protocol (BGP) is an inter-autonomous system routing protocol. An autonomous system is a network or group of networks under a common administration and with common routing policies. BGP is used to exchange routing information for the Internet and is the protocol used between Internet service providers (ISP). Customer networks, such as universities and corporations, usually employ an Interior Gateway Protocol (IGP) such as RIP or OSPF for the exchange of routing information within their networks. Customers connect to ISPs, and ISPs use BGP to exchange customer and ISP routes. When BGP is used between autonomous systems (AS), the protocol is referred to as External BGP (EBGP). If a service provider is using BGP to exchange routes within an AS, then the protocol is referred to as Interior BGP (IBGP).BGP AttributesRoutes learned via BGP have associated properties that are used to determine the best route to a destination when multiple paths exist to a particular destination. These properties are referred to as BGP attributes, and an understanding of how BGP attributes influence route selection is required for the design of robust networks. This section describes the attributes that BGP uses in the route selection process:

l Weight

l Local preference

l Multi-exit discriminator

l Origin

l AS_path

l Next hop

l Community

Weight AttributeWeight is a Cisco-defined attribute that is local to a router. The weight attribute is not advertised to neighboring routers. If the router learns about more than one route to the same destination, the route with the highest weight will be preferred.

Local Preference AttributeThe local preferenceattribute is used to prefer an exit point from the local autonomous system (AS).

Unlike the weight attribute, the local preference attribute is propagated throughout the local AS. If there are multiple exit points from the AS, the local preference attribute is used to select the exit point for a specific route.

Multi-Exit Discriminator AttributeThe multi-exit discriminator (MED) or metric attribute is used as a suggestion to an external AS regarding the preferred route into the AS that is advertising the metric.The term suggestion is used because the external AS that is receiving the MEDs may be using other BGP attributes for route selection.

OSPF Features

Additional OSPF features include equal-cost, multipath routing, and routing based on upper-layer typeof-service (TOS) requests. TOS-based routing supports those upper-layer protocols that can specif particular types of service. An application, for example, might specify that certain data is urgent. If OSPFhas high-priority links at its disposal, these can be used to transport the urgent datagram.

Routing HierarchyUnlike RIP, OSPF can operate within a hierarchy. The largest entity within the hierarchy is theautonomous system (AS), which is a collection of networks under a common administration that share a common routing strategy. OSPF is an intra-AS (interior gateway) routing protocol, although it is capable of receiving routes from and sending routes to other ASs.

Open Source Streaming Server Product Information

Note: Because this chapter deals with multimedia data transmission and streaming servers, the products available in the market have also been discussed.

Apple Computers, Inc. has developed a streaming server which is called Darwin Streaming Server. This is an open source version of streaming server technology that allows a user to make changes according to the requirement and to send multimedia data to clients across the Internet. Industry standard protocols such as RTP and RTSP are used for this purpose. Darwin Streaming Server supports a high level of customizability and runs on a variety of platforms that allows a user to manipulate the code.

Darwin Streaming Server can be extended or modified. Darwin Streaming Server can be modified to alter MPEG-4 media and QuickTime Streaming Server (QTSS), which is Apples commercial streaming server. QTSS is delivered as a part of Mac OS X Server on alternative platforms such as Windows, Linux, and Solaris.

Darwin Streaming Server 5.5 is the latest version available and includes the following enhancements:

n Latest security update changes

n Latest 3GPP release 5 client support

n High-definition H.264 streaming

n Support for automatic bandwidth detection with QuickTime 7 Player

n A security update for Windows

The source code of Darwin Streaming Server 5.5 currently supports Mac OS X Server, Linux (Red Hat 8 or higher recommended), Solaris 9, and Windows 2000/2003 Server. The source code of Darwin Streaming Server can be compiled and run on these operating systems.

Origin AttributeThe origin attribute indicates how BGP learned about a particular route. The origin attribute canhave one of three possible values:l IGPThe route is interior to the originating AS. This value is set when the network router

configuration command is used to inject the route into BGP.

l EGPThe route is learned via the Exterior Border Gateway Protocol (EBGP).

l IncompleteThe origin of the route is unknown or learned in some other way. An origin of

incomplete occurs when a route is redistributed into BGP.

AS_path Attribute

When a route advertisement passes through an autonomous system, the AS number is added to anordered list of AS numbers that the route advertisement has traversed. Figure 2.11 shows the situation in which a route is passing through three autonomous systems.

Next-Hop Attribute

The EBGP next-hop attribute is the IP address that is used to reach the advertising router. For EBGP peers, the next-hop address is the IP address of the connection between the peers.

Community Attribute

The community attribute provides a way of grouping destinations, called communities, to which routingdecisions (such as acceptance, preference, and redistribution) can be applied. Route maps are used to set the community attribute. Predefined community attributes are listed here:

l no-exportDo not advertise this route to EBGP peers.

l no-advertiseDo not advertise this route to any peer.

l internetAdvertise this route to the Internet community; all routers in the network belong to

it.

BGP Path Selection

BGP could possibly receive multiple advertisements for the same route from multiple sources. BGP

selects only one path as the best path. When the path is selected, BGP puts the selected path in the IP

routing table and propagates the path to its neighbors. BGP uses the following criteria, in the order

presented, to select a path for a destination:

l If the path specifies a next hop that is inaccessible, drop the update.

l Prefer the path with the largest weight.

l If the weights are the same, prefer the path with the largest local preference.

l If the local preferences are the same, prefer the path that was originated by BGP running on

this router.

l If no route was originated, prefer the route that has the shortest AS_path.

l If all paths have the same AS_path length, prefer the path with the lowest origin type (where

IGP is lower than EGP, and EGP is lower than incomplete).

l If the origin codes are the same, prefer the path with the lowest MED attribute.

l If the paths have the same MED, prefer the external path over the internal path.

l If the paths are still the same, prefer the path through the closest IGP neighbor.

\

Troubleshooting DNS Server

nslookup is a command line utility that enables you to perform tests to verify whether the resource records are added or updated correctly or not. The nslookup command helps resolve addresses for resources on the DNS server, performs DNS queries, and examines the content of zone files on the DNS server. The command also helps diagnose and solve name resolution problems when the machine name does not get resolved while accessing the network.

Syntax nslookup [-Subcommand ...] [{ComputerToFind| [-Server]}]

The above parameters are explained below:

n Subcommand: Specifies one or more nslookup subcommands as a command-line option such as nslookup: exit, nslookup: finger, nslookup: ls, nslookup: lserver

asses less routing traffic than it would if the AS were not partitioned.

Area partitioning creates two different types of OSPF routing, depending on whether the source and

the destination are in the same or different areas. Intra-area routing occurs when the source and destination

are in the same area; interarea routing occurs when they are in different areas.

SPF Algorithm

The Shortest Path First (SPF) routing algorithm is the basis for OSPF operations. When an SPF

router is powered up, it initializes its routing-protocol data structures and then waits for indications from

lower-layer protocols that its interfaces are functional.

After a router is assured that its interfaces are functioning, it uses the OSPF Hello protocol to acquire

neighbors, which are routers with interfaces to a common network. The router sends hello packets to its

neighbors and receives their hello packets. In addition to helping acquire neighbors, hello packets also act

5 as keepalives to let routers know that other routers are still functional

. How can the present Internet be made to port multimedia data? For making the existing Internet portable to multimedia data, the following modifications need to be done:n A protocol is required that reserves bandwidth on behalf of the streaming server applications.n The scheduling policies in the router queues should be modified so that the bandwidth reservations can be done. With the new scheduling policies, not all packets get equal treatment, instead the packets from the multimedia provider sites that reserve and pay more, get more bandwidth.

n The applications must give the network a description of the traffic that they intend to send to the network.

n The bandwidth and switching capacity should be enhanced to provide satisfactory delay and packet loss performance within the network.

n Caches must be installed in the networks. Caches bring stored content (web pages as well as stored audio and video) closer to users, thereby reducing the traffic in the higher-tier ISPs.

n Content providers that pay for a Content Distribution Networks (CDN) service should deliver content faster and more effectively.

Multicast overlay networks can be deployed. A multicast overlay network consists of servers scattered throughout the ISP network and potentially throughout the entire Internet. Servers and the logical links between servers collectively form an overlay network, which multicasts traffic from a source

. How can the present Internet be made to port multimedia data? For making the existing Internet portable to multimedia data, the following modifications need to be done:n A protocol is required that reserves bandwidth on behalf of the streaming server applications.n The scheduling policies in the router queues should be modified so that the bandwidth reservations can be done. With the new scheduling policies, not all packets get equal treatment, instead the packets from the multimedia provider sites that reserve and pay more, get more bandwidth.

n The applications must give the network a description of the traffic that they intend to send to the network.

n The bandwidth and switching capacity should be enhanced to provide satisfactory delay and packet loss performance within the network.

n Caches must be installed in the networks. Caches bring stored content (web pages as well as stored audio and video) closer to users, thereby reducing the traffic in the higher-tier ISPs.

n Content providers that pay for a Content Distribution Networks (CDN) service should deliver content faster and more effectively.

Multicast overlay networks can be deployed. A multicast overlay network consists of servers scattered throughout the ISP network and potentially throughout the entire Internet. Servers and the logical links between servers collectively form an overlay network, which multicasts traffic from a source

10. Discuss the features of Real Time Protocol (RTP).The features of Real Time Protocol (RTP) are:n RTP provides end-to-end delivery services for data with real-time characteristics such as interactive audio and video. However, RTP itself does not provide any mechanism to ensure timely delivery. It needs support from the lower layers of OSI model that actually have control over resources in switches and routers. RTP depends on Resource Reservation Protocol (RSVP) to reserve resources and to provide the requested quality of service.n RTP provides timestamps, sequence numbers as hooks for adding reliability, flow, and congestion control for packet delivery, but implementation is totally left to the application.

n RTP is a protocol framework that is deliberately not complete. It is open to new payload formats and new multimedia software. By adding new profile and payload format specifications, one can tailor RTP to new data formats and new applications.

n The flow and congestion control information of RTP is provided by Real-Time Control Protocol (RTCP) sender and receiver reports.

Q. What are the limitations of best effort service? Explain.Ans: These are Limitations of the best effort service*Packet Loss: Consider one of the UDP segments generated by our Internet phone application. The UDP segment is encapsulated in an IP datagram. As the datagram wanders through the network, it passes through buffers (that is, queues) in the routers in order to access outbound links. It is possible that one or more of the buffers in the route from sender to receiver is full and cannot admit the IP datagram. In this case, the IP datagram is discarded, never to arrive at the receiving application.*End-to-End Delay: End-to-end delay is the accumulation of transmission, processing, and queuing delays in routers; propagation delays in the links; and end-system processing delays. For highly interactive audio applications, such as Internet phone, end-to-end delays smaller than 150 milliseconds are not perceived by a human listener; delays between 150 and 400 milliseconds can be acceptable but are not ideal; and delays exceeding 400 milliseconds can seriously hinder the interactivity in voice conversations. The receiving side of an Internet phone application will typically disregard any packets that are delayed more than a certain threshold, for example, more than 400 milliseconds. Thus, packets that are delayed by more than the threshold are effectively lost. * Packet Jitter: Varying delays within the network, the time from when a packet is generated e source until it is received at the receiver can fluctuate from packet to packet. This phenomenon is called jitter. For an example, consider two consecutive packets within a talk spurt in our Internet phone application. The sender sends the second packet 20 msec after sending the first packet. But at the receiver, the spacing between these packets can become greater than 20 msec. To see this, suppose the first packet arrives at a nearly empty queue at a router, but just before the second packet arrives at the queue a large number of packets from other sources arrive at the same queue. Because the first packet suffers a small queuing delay and the second packet suffers a large queuing delay at this router, the first and second packets become spaced by more than 20 mecs.Q. What is multimedia? What is streaming server? Explain audio streaming process.

Ans: Multimedia- The word multimedia is a compound of the Latin prefix multi meaning many, and the Latin-derived word media, which is the plural of the world medium. So multimedia simply means using more than one kind of medium. Multimedia is the mixture of two or more media effects-Hypertext, Still Images, sound, Animation and Video to be interacted on a computer terminal.

Streaming Server: The Server which delivers the audio/video over non-HTTP protocol (Protocols that can be either proprietary or open standards) is called streaming server. In order to get around HTTP and /or TCP, audio/video can be stored on and sent from a streaming server to the media player. This streaming server could be a proprietary streaming server, such as those marketed by Real Networks and Microsoft, or could be a public-domain streaming server. With a streaming server, audio/video can be sent over UDP (rather than TCP) using application-layer protocols that may be better tailored than HTTP to audio/video streaming.

Audio Streaming:

The browser process establishes a TCP connection with the Web server and requests the audio/video file with an HTTP request message.

(i) The Web server sends the audio/video file to the browser in an HTTP response message.

The content-type header line in the HTTP response message indicates a specific audio/video encoding. The client browser examines the content

Chapter Four Wireless Local Area Network (WLAN)Wireless TechnologiesSome of the wireless technologies are:n Bluetooth: It is a wireless technology. It is a short-range communications system intended to replace the cables connecting portable and/or fixed electronic devices. The key features of Bluetoothtechnology include robustness, low power, and low cost.

Bluetooth offers a number of advantages. It provides a simple choice for convenient, wire-free, short-range communication between devices. It is a globally available standard that wirelessly connects mobile phones, portable computers, cars, stereo headsets, MP3 players, and more. It is best suited for connecting PDA (Personal Digital Assistance) and cell phones.

n IEEE 802.16a (WiMAX):It is commonly referred to as WiMAX or less commonly as Wireless MAN or the Air Interface Standard, IEEE 802.16 is a specification for fixed broadband wireless metropolitan access networks. It provides added support for the 2 to 11 GHz range.

n IEEE 802.11g (Wi-Fi):It has a frequency up to 54Mbps in the 2.4GHz band. Products that adhere to this standard are considered Wi-Fi Certified. Products in this standard are compatible with 802.11b and support 14 channels available in the 2.4GHz band with only three non-overlapping channels.

IEEE 802.11a (Wi-Fi): It has frequency up to 54Mbps in the 5GHz band. The products that adhere to this standard are considered Wi-Fi Certified. Products in this standard have eight available channels. This standard is better than 802.11b a

n t supporting multimedia voice, video and large image applications in densely populated user environments. It has a relatively shorter range than 802.11b and is not interoperable with 802.11b.

type of the response message, launches the associate media player, and passes the