Download networks lab

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Remote Desktop Services wikipedia , lookup

IEEE 1355 wikipedia , lookup

Lag wikipedia , lookup

Transcript
CS1306 - Networks
Laboratory
HANDLED BY,
A.MAHESH PRIYA L/IT
Powerpoint Templates
Page 1
LIST OF EXPERIMENTS
1.Write a socket Program for Echo / Ping /
Talk commands.
2. Create a socket (TCP) between two
computers and enable file transfer
between them.
3. Write a program to implement Remote
Command Execution (Two M/Cs must
be used)
4. Write a program to implement CRC and
Hamming code for error handling.
5. Write a code simulating Sliding Window
Protocols.
Powerpoint Templates
Page 2
6.A Client − Server application for
chat.
7. Write a program for File Transfer
in client–server architecture using
following methods.
a. USING RS232C
b. TCP/IP
8. Perform a case study about the
different routing algorithms to
select the network path with its
optimum and economical during
data transfer.
Powerpoint Templates
Page 3
a. Shortest path routing
b. Flooding
c. Link State
d. Hierarchical
9 and 10 Study of Network
Simulators like NS2 / Glomosim
/ OPNET.
Powerpoint Templates
Page 4
Ex.1A
Implementation of Echo
Command
•
•
•
•
Start the program.
Get the input as command line.
Display the input on the screen.
Terminate the program.
Powerpoint Templates
Page 5
SAMPLE OUTPUT
[satheesh@linuxserver ~]$ cc ec.c
[satheesh@linuxserver ~]$ ./a.out
welcome to networks lab
welcome to networks lab
Powerpoint Templates
Page 6
Ex.No.1B
Implementation of Ping Command
1.start the program.
2.Find the System IP address.
3.Execute the program with IP
Address.
4.Check whether the system is
eligible to connect with network.
5.Stop the program.
Powerpoint Templates
Page 7
SAMPLE OUTPUT
• [root@linuxserver ~]$ cc rpcli.c
• [root@linuxserver ~]$ ping 172.16.1.20
• PING 172.16.1.20 (172.16.1.20) 56(84)
bytes of data.
• 64 bytes from 172.16.1.20: icmp_seq=1
ttl=64 time=0.021 ms
• 64 bytes from 172.16.1.20: icmp_seq=2
ttl=64 time=0.009 ms
• 64 bytes from 172.16.1.20: icmp_seq=3
ttl=64 time=0.017 ms
Powerpoint Templates
Page 8
Ex.No.3
REMOTE COMMAND EXECUTION
1.Start the Program.
2.write seperate program for server and
client.
3.Declare the variable and structure of
program.
4.Create socket using socket function.
5.Execute the server program.
6.Execute the client program.
7.enter the command to the server.
8.Get response from the server.
Powerpoint Templates
Page 9
9.Stop the program.
SAMPLE OUTPUT
Client:
[staffs@linuxserver ~]$ cc rpcli.c
[staffs@linuxserver ~]$ ./a.out 127.0.0.1
Enter the command to server
who
Server:
[satheesh@linuxserver ~]$ ./a.out
Command received from client 1 is who
satheesh pts/0
2010-04-09 22:31 (172.16.1.241)
staffs pts/1
2010-04-09 22:34 (172.16.1.241)
Powerpoint Templates
Page 10
Ex.No 4A
CYCLIC REDUNDANCY CHECK
Aim:
Start the program.
Get the data to be transmitted.
Take it as dividend.
Get the divisor.
Add n-1 0’s with the data where n is the
divisor.
• Divide the data by the divisor and append
the remainder as CRC.
• Data + CRC is transmitted to receiver.
•
•
•
•
•
Powerpoint Templates
Page 11
• In the receiving end, the data
received is divided by the same
divisor and the remainder is
checked whether all the bits are
0’s.
• If all the bits are 0’s, then there is
no error.
• Stop the program.
Powerpoint Templates
Page 12
SAMPLE OUTPUT
1.Without error
2.With error
3.Exit
Enter the option:
1
Enter the dividend:11000
Enter the divisor:11
Computed data + CRC is:11000
Data is transmitted
Data is received
Received data+CRC:11000
Remainder is :00000
Data is received correctly
Powerpoint Templates
Page 13
Ex.No.4B
Hamming Code Implementation
1.Start the program.
2.Get the 7bit data to be tranmitted.
3.Add Parity check bits in 1,2,4,8th
positions.
4.11 bit data is transmitted to
receiver 5.In receiving end check
the data using same process which
is done by receiver.
6.find the corresponding error bit.
Powerpoint Templates
Page 14
7.stop the program
SAMPLE OUTPUT
Enter the data string
1
1
1
1
0
1
0
The transmitting data is:
11111010010
•
Powerpoint Templates
Page 15
Received data:
1
0
1
1
1
0
1
0
0
1
0
Error bit is:1 0 1 0
Powerpoint Templates
Page 16
Ex.No.5
Sliding Window Protocol
Simulation
•
•
•
•
•
•
•
Start the program.
Get the frame size of the sender.
Get the frame size of the receiver.
Send the frames from sender.
Receive the frames in receiver side.
Send the acknowledgement.
Terminate the program
Powerpoint Templates
Page 17
SAMPLE OUTPUT
Sending one frame...
Sender Window
|
Received one frame....
Receiver Window
|
Sending ACK for received frames 1
Receiver Window
--|00|
--Received ACK 2
Sender window:
--|00|
--Templates
Sending ACKPowerpoint
for received
frames 0
Page 18
Ex.No.6
A Client Server Application for Chat
•
•
•
•
Start the program.
Open the socket in server side.
Open the socket in client side.
Send the message to client using the
socket.
• Receive the message in client and
display as response.
• In the client side enter the host name
before chat.
• Terminate
the
program.
Powerpoint Templates
Page 19
SAMPLE OUTPUT
ruby@thermopylae:~$ cc chatclient.c
opening fifo to server
FIFO open waiting
Enter the string set to send:Welcome To
Networks Lab
ruby@thermopylae:~$ ./a.out
Starting FIFO server
FIFO open waiting
from client: Welcome To Networks Lab
Powerpoint Templates
Page 20
Ex.No.7A
File Transfer using RS-232
Interface
• Start the program.
• Initiate the port for input and output in two
systems.
• Get the file name to be transferred.
• Open the file.
• Open the output port and send the data.
• Close the file.
• In the receiving end open the input port.
• Set the port to receive the data.
• Get the data and display on the screen.
• Close the ports.
Powerpoint Templates
• Terminate the program.
Page 21
SAMPLE OUTPUT
[staffs@pitstelnet ~]$ cc cli.c
[staffs @pitstelnet ~]$ ./a.out
172.16.1.20 source.txt 8000
File send over RS232
[staffs@pitstelnet ~]$
[[staffs@pitstelnet ~]$cc ser.c
[staffs@pitstelnet ~]$ ./a.out 8000
File received from client. Socket
closed.
Powerpoint Templates
[staffs@pitstelnet
~]$
Page 22
Ex.No.7B
File Transfer using TCP/IP
Server side File transfer Algorithm
1 .Start the program.
2.Declare the variables and structure
for the socket.
3.Create socket using socket
function.
4.socket is binded as specified port.
5.Using the object the port and
addressPowerpoint
is declared.
Templates
Page 23
Client side File transfer algorithm:
1.Start the program.
2. Declare the variables and structure.
3.Socket is created and connects
function is executed.
4.If the connection is successful then
server sends the message.
5.The file name that is to be transferred
is specified in the client side.
6.The file is verified from server side.
7. Stop the program.
Powerpoint Templates
Page 24
SAMPLE OUTPUT
ruby@thermopylae:~$ cc ClientTcp.c
ruby@thermopylae:~$ ./a.out
enter the serverip address 172.16.1.20
socket created
connected to server
enter the file name crc3.c
ruby@thermopylae:~$ cc ServerTcp.c
ruby@thermopylae:~$ ./a.out
socket is created
binded successfully
The file has been transferred
Powerpoint Templates
Page 25
CASE STUDY
Shortest path routing
Flooding
Link State
Hierarchical
NETWORK SIMULATION:
NS2
Glomosim
OPNET.
Powerpoint Templates
Page 26
Powerpoint Templates
Page 27