Sie sind auf Seite 1von 13

BITCIT506R03

COMPUTER NETWORKS LAB












Department of Information Technology,
School of Computing,
Shanmugha Arts, Science, Technology and Research Academy SASTRA University,
Tirumalaisamudram, Thanjavur
List of experiments

1. Simple network programs
a). Program to find IP address of a computer.
b). Program for using Ping command.
c). Program to send messages to other users in a network.
2. Programs for information exchange between client and server using TCP and UDP.
3. Secured communication through encryption and decryption of messages.
4. Program for remote procedure call under client server environment (RMI).
5. Implement data link layer framing method bit stuffing.
6. a). Program for error correction using CRC.
b). Program for error detection using Hamming Code.
7. Serial Communication between PCs (Character Transfer) - Communication via RS
232.
8. Implementation of Sliding window protocols - go back n and selective repeat.
9. Take a sample subnet graph with weights indicating delay between nodes. Now
obtain the routing table at each node using distance vector routing.
10. a) Tuning the TCP Kernel: Use the sysctl command to read and manipulate the
various TCP parameters. e.g sysctl -a , sysctl -p and sysctl -w.
b)TCP Keep alive time: Display the current TCP keepalive time value using the
sysctl command and change that using echo command - e.g echo 3600 >
/proc/sys/net/ipv4/tcp keepalive time.
11. Simulation of wired and wireless networks.
12. Network performance evaluation using simulator.
13. Study of SASTRA network infrastructure.


1. a). Program to find IP address of a computer.
Objective
To find the IP address of the local host
To find the IP address of the remote systems in the current network
To get the name of the specified IP address
Procedure
Import the java.net package to utilize the built-in classes
Use InetAddress class for invoking the following methods.
isReachable() - to check the availability
getHostAddress() getting address
getHostName() getting name
Input Output
System name / IP availability, name and IP address

1.b . Program for using Ping command
Objective
To check the availability of any system in the current network.
Procedure
-- Import the java.io package to utilize the built-in classes
Use Process and Runtime class for invoking the following methods.
getRunTime()
exec()
Form the String pingCmd = ping + IP / name
Command pingcmd is executed using the above methods.
Read the information from the process object and display it in the console
using BufferedReader.
Input Output
System IP / Name No. of Packet throughput
Approximate round trip
time

1. c). Program to send messages to other users in a network
Objective
To transfer messages between the systems within the current network
Procedure
-- Import the java.io package to utilize the built-in classes
Use Process and Runtime class for invoking the following methods.
getRunTime()
exec()
Form the String Cmd = net send + IP / name + + msg
Command cmd is executed using the above methods.

Input Output
System IP /name and message Successfully sent

Pre Lab: Practice the DOS commands ipconfig , ping, net send with all possible options.
Prior working knowledge in Java.




2. Programs for information exchange between client and server using TCP and UDP.
a. Objective
To transfer a text file from one machine to other using TCP.
Procedure
-- Import java. io and java.net packages to utilize the built-in classes
Socket Class for Client program
ServerSocket Class for ServerSide program
In server script should be bound with a particular port number and the client
req should be forwared to that specific port.
accept() is used to accept the client connection request.
Using FileWriter Class, the received text is written in the new file.

b. Objective
To transfer a text file from one machine to other using UDP.
Procedure
-- Import java. io and java.net packages to utilize the built-in classes
DatagramSocket Class for generating UDP socket
DatagramPacket Class for form the data container .
send() to send the packet to the destination.
receive() to receive the packet from the client/server
Using FileWriter Class, the received text is written in the new file.

Pre Lab: knowledge about Transport layer protocols- TCP and UDP
Basic client server program.


3. Secured communication through encryption and decryption of messages.
Objective
To encrypt a plain text using a key and transmit the cipher text; decrypt the cipher text at the
receiver side to get back the original message (Hint: Use Ceaser Cipher)

Procedure
1. Get the key.
2. Replace each character with the character, which is, key positions ahead.
3. Send the encrypted message.
4. Decrypt the message received by replacing each character with the character, which is
key positions behind.
For data transfer, use either TCP or UDP.

INPUT OUTPUT
HELLO , 2 => JGNNQ JGNNQ=> HELLO

Pre Lab: Counting the number of vowels, characters, and words.
4. Program for remote procedure call under client server environment (RMI)
Objectives
Learn the concepts of Remote Procedure Call and Remote Method
Invocation
Learn to develop applications which uses Distributed Objects
Learn the working and significance of stub object (Client side )and
Skeleton objects (Server side).

Procedures
Creating the RMI server
Contains both class and interface
Creating an interface
Both client and server have to agree
Implementing the interface
Binding with RMI registry
Should contain the operational code
Creating the RMI client
Call Registry to obtain reference to remote object
Compiling and starting the server
Input Output
Parameters (operands) Return value ( Computed results)
(e.g 4
4
) 256


5. Implement data link layer framing method bit stuffing
Objectives
Learn the importance of bit stuffing in communication and network protocols
Learn to synchronize sender and receiver
Learn to create communication protocols having fixed frame size
Procedures
Creating two file pointers, one is read and another in write mode for input and output
files
Access the given input binary file in read mode
If there is any consecutive five 1s, add a stuff bit 0
Open the output file and write the stuffed string
At receiver end the additional stuffed bits are rejected at the Data Link layer


Pre Lab: Bitwise arithmetic operation and shifting operation.

6. a). Program for error detection using CRC.
Objectives
Learn error detection concepts
Learn how to choose Pattern P (divisor for CRC algorithms
Learn to generate Frame Check Sequence (FCS which is to be added at end of
the message bits
Procedures
Choose n and k(number of msg bits) value
Where (n-k) is the frame check sequence(FCS) size.
Choose pattern P where as it should be atleast one bit greater than the FCS.
LSB and MSB in P should be 1.
Divide the msg bit by P . Add the remainder with the msg bit.
At the receiver end the transmitted data is divided by the same pattern P.
If the remainder is zero , No Error in the code Otherwise Error is Detected.


6.B Hamming code Error detection and correction
Objectives
Learn Error detection and correction Mechanisms
Procedure
calculate the redundancy bit r1,r2,r4 and r8
Calculate the parity for each parity bit (a ? represents the bit position being set):
Position 1 checks bits 1,3,5,7,9,11:
? _ 1 _ 0 0 1 _ 1 0 1 0. Even parity so set position 1 to a 0: 0 _ 1 _ 0 0 1 _ 1 0 1 0
Position 2 checks bits 2,3,6,7,10,11:
0 ? 1 _ 0 0 1 _ 1 0 1 0. Odd parity so set position 2 to a 1: 0 1 1 _ 0 0 1 _ 1 0 1 0
Position 4 checks bits 4,5,6,7,12:
0 1 1 ? 0 0 1 _ 1 0 1 0. Odd parity so set position 4 to a 1: 0 1 1 1 0 0 1 _ 1 0 1 0
Position 8 checks bits 8,9,10,11,12:
0 1 1 1 0 0 1 ? 1 0 1 0. Even parity so set position 8 to a 0: 0 1 1 1 0 0 1 0 1 0 1 0
Code word: 011100101010.
Error Detection and correction
Calculate r1,r2,r4 and r8.
if r1,r2,r4 and r8 are zero, No single bit error occurred.
By using these check bit values we can detect the error bit position.
Pre Lab: simple division in binary number format.
7. Serial Communication between PCs (Character Transfer) - Communication via
RS 232.
Objective
To demonstrate using JAVA code, the data transfer between two
machines using RS232 serial interface
Procedure:
For writing into serial port:
Design a window at the sender side that will have a text field to accept the
message and a button to send.
Use the static method CommPortIdentifier. getPortIdentifier to get the list of
available ports.
Create SerialPort object for each of the entries in CommPortIdentifier list and
open the port with port number 2000.
Set the SerialPort parameters like baudrate, databits, stopbits and parity.
Write the message to the output port created.
Use SerialPortEventListener Interface to monitor the port for reading and
capturing the data.
For reading from serial port:
Design a window at the sender side that will have a text field to accept the
message and a button to send.
Use the static method CommPortIdentifier.getPortIdentifier to get the list of
available ports.
Create SerialPort object for each of the entries in CommPortIdentifier list and
open the port with port number 2000.
Set the SerialPort parameters like baudrate, databits, stopbits and parity.
Bind the SerialPortEventListener to the SerialPort object.
Set notifyonDataAvailable as True.
Implement the serialEvent method to read the data available on the port.


8. Sliding window protocols - go back n and selective repeat
Objectives
Learn transmission control protocols
Go Back n
Divide the input data in to n packets
Predetermined number of packets k should be sent to the receiver without ACK.
Send will be waiting for the ACK , until it receives ACK.
If ACK is missed for the any PKT r , all the pkts after r will be retransmitted.


Selective Repeat
Divide the input data in to n packets
Predetermined number of packets k should be sent to the receiver without ACK.
Send will be waiting for the ACK , until it receives ACK.
If ACK is missed for the any PKT r , the pkt r alone will be retransmitted

Pre Lab: Packet transmission with ACK between client and server.
9.Information transfer using Distance vector routing protocols
Description:
Routers using distance-vector protocol do not have knowledge of the entire path to a
destination
Simulation of Distance vector routing protocols by constructing and displaying the
routing table at each node.

Prelab
Knowledge of functioning of the protocol and the routing table format for the protocol
10. Using sysctl configure kernel parameters at runtime
Objectives
Learn to read and modify the TCP kernel parameters using sysctl in linux.
Procedure
Tuning the TCP Kernel: Use the sysctl command to read and
manipulate the various TCP parameters. e.g sysctl -a , sysctl -p and
sysctl -w.
TCP Keep alive time: Display the current TCP keepalive time value
using the sysctl command and change that using echo command -
e.g echo 3600 > /proc/sys/net/ipv4/tcp keepalive time.
Pre Lab: Prior working knowledge in Linux/unix platform and unix system commands.

11. Simulation of wired and wireless networks.
Objectives
Learn to construct the wired and wireless network in NS2 simulator.
Procedure
Create N nodes
Make connectivity between the nodes.
Simulate data transmission
1 to 1 transmission
1 to N transmission
12.Network performance evaluation using simulator.
Objectives
To evaluate the network parameters using ns2 simulator
Procedure
Link connectivity
Monitor the Bandwidth of the network
Analyse Round trip time taken for the Test packet.

13. Study of SASTRA network infrastructure
Objective:
To study and understand the architecture, topology adopted in SASTRAs
infrastructure.
Study about the Wireless and wired network architecture and server configuration.
ADDITIONAL EXERCISES
1. Write a java program to read the characters from a file and write its uppercase
counterpart in a new file.(File concept)
2. Create a LAN chat application(GUI) in java.(Network UDP)
3. Write a java program to transfer a data file to the specific destination.

Das könnte Ihnen auch gefallen