PDA

View Full Version : Network Programming (3487) spring 2012 assignment for Aiou



Xpert
07-28-2012, 06:37 PM
Course: Network Programming (3487) Semester: Spring, 2012
Level: Bachelor Total Marks: 100


ASSIGNMENT No. 1

Note: All questions carry equal marks.

Q. 1 Define Winsock. Also describe the characteristics of connectionless and connection oriented Winsock's.

Q. 2 What is application programming interface (API)? Also explain the features and importance of APIs.

Q. 3 Study the behaviors of IPv4 and IPv6 in view of current research scenario and write a report on its characteristics.

Q. 4 Describe the modes of socket. Also discuss the techniques used for these modes.

Q. 5 a) What is Winsock input output methods? Elaborate these methods in detail.
b) Study the Winsock scalabilities and write your findings in form of research report.



ASSIGNMENT No. 2

Note: All questions carry equal marks.

Q. 1 Discuss the scalability of Winsock Server. Architecture in detail.

Q. 2 Define IOCTLS. Also give detailed explanation of WSAIoctl and WSANSPIoctl.

Q. 3 Study the techniques used for registering and queuing a service in network programming environment and write an article on your study and research.

Q. 4 Write a small application in any programming language for simple echo messaging in a home network.

Q. 5 Write an application for distributed battleship game as described below:

Application Description
From Wikipedia: Battleship is a famous paper-and-pen game for two players. The game is played on four square grids, two for each player. The grids are typically square;—often 10x10—and the individual squares in the grid are identified by letter and number. On one grid the player arranges his own ships and records the shots by the opponent. On the other grid, the player records his own shots.
Before play begins, each player arranges a number of ships secretly on the grid for that player. Each ship occupies a number of consecutive squares on the grid, arranged either horizontally or vertically. The number of squares for each ship is determined by the type of the ship. The ships cannot overlap (i.e., at most one ship can occupy any given square in the grid). The types and numbers of ships allowed are the same for each player:

Number
Type of ship
Size


1
Aircraft Carrier


5


1
Battleship


4


1
Submarine


3


1
Destroyer


3


1
PT Boat


2

After the ships have been positioned, the game proceeds in a series of rounds. In each round, each player has a turn. During a turn, the player announces a target square in the opponents' grid which is to be shot at. If a ship occupies the square, then it takes a hit. After each successful hit, the same player is allowed to do another shot.
When all of the squares of a ship have been hit, the ship is sunk. After the target has been given, the opponent then announces which of his ships have been hit. If at the end of a round all of one player's ships have been sunk, the game ends and the other player wins.

Lab Exercise
The Lab exercise is the development of a distributed battleship game. You have to develop an NET application for 10x10 battleship game grid, either as console or as GUI application.
It is suggested to follow these steps in the application development:
· Familiarize yourself with the Visual Studio 2005 development environment Pick your favorite development language.
· Create a new NET application. Experienced .NET developers might want to create a (graphical) Windows application, everybody else should start with a console application. This application will act as your Battleship game server, implementing the interface for calls from other implementations.
· Integrate the provided library (InterBattleShip.dll), which contains the common interface definition for all participating game implementations. Take a look on the interface with the help of the object browser in Visual Studio. Figure out what the valid value range for the Fire() parameters is. Draw a sequence diagram for the assumed usage of this interface. Add this picture to your transcript.
· Implement the IBattleShip interface in your application, by outputting some message when one of the methods is called. Do some tests with your implementation, for example by calling Fire() several times in a separate test routine, which is called by Main().
· Make yourself familiar with .NET Remoting, by reading the according MSDN resources. Change your application in a way that the IBattleShip methods are callable over .NET Remoting. Document the relevant steps and thoughts in your transcript.
· Add a second project to your solution, which implements another .NET application, Let this application perform Remoting test calls to your server implementation, based on the user input. You can also use a more advanced unit testing framework for this application, like NUnit.
· Extend your server implementation to support a statically defined game grid. One possibility is a pre-defined two-dimensional array of values. After every received Fire() attempt, the program should print out the new status of the grid. The Fire() method now needs to return the correct result value from the game grid. Therefore, the server needs to protocol which ship parts were already hit, and needs to reset this matrix with every Start New Game() call. When the last ship part was shot, the return value for Fire() must change accordingly.
· Try to fire at different positions with your Remoting client, and check that everything is working.
· Extend your server implementation to support the creation of a custom ship placement at application start. You can assume that user inputs are always valid, in order to ease up the implementation.
· Optional: Finally implement the game rules - call Fire() on other side when there was amiss in the last tiring attempt received. This works if the application calling Start New Game() on the other side also provides a remoting endpoint for its own server interface. Therefore, both communication partners act both as server and as client, depending on the current game situation. Beside other things, this demands the migration of the user input routines from your test client to the server. The initial role distribution (who calls Start New Game() and Fire() first) can be implemented as command-line option or user question after application start. Let two instances of your application play against each other.
· Optional: Try to play against some other implementation in the lab.
· Optional: Think about possible solutions to make your application independent from the runtime environment. How could applications detect each other? Document your thoughts in the record.

Examination
Hand-in a transcript of your individual solution (<= 3 pages), to the course teacher. The document should describe your implementation layout, your problems during the implementation and your solution. You can also suggest useful extensions for the lBattleShip interface, based on your implementation experience. An individual code review should be for each student by the teacher.
3487 Network Programming Credit Hours: 3 (2+1)

Recommended Book:
Network Programming for Microsoft Windows: Second Edition by Anthony Jones

Course Outlines:
Unit No. 1 Winsock & its Design
¨ Initializing and Creating Winsock
¨ Connectionless, Connection Oriented Winsock and APIs
¨ Protocol Characteristics, WinSock Catalog

Unit No. 2 Internet Protocol
¨ IPv4 & IPv6
¨ Addressing and Name Resolution
¨ Writing IP Version _ Independent Programs

Unit No. 3 WinSock I/O Methods
¨ Socket Modes, Socket I/O Models
¨ I/O Model Consideration

Unit No. 4 Scalable WinSock Applications
¨ APIs and Scalabilities
¨ Scalable Server Architecture
¨ Server Strategies

Unit No. 5 Socket Options and Ioctls
¨ Socket Options
¨ Ioctlesocket, WSAIostl and WSANSPIostl

Unit No. 6 Registration and Name Resolution
¨ Name Space Model
¨ Registering a Service
¨ Querying a Service

Unit No.7 Winsock Programming
¨ TCP and UDP Client Server
¨ TCP and UDP Day Time Servicing
¨ TCP and UDP echo

Unit No. 8 Generic Quality of Service
¨ QOS and WinSock
¨ Terminating QOS
¨ Programming QOS

Unit No. 9 RAW Sockets
¨ RAW Sockets Creation
¨ ICMP
¨ Using IP Header Include Option