Posts

Showing posts from August, 2016

QESTION BANK FOR CN

Explain Data link layer design issues. With a neat diagram compare the uses and functions of different hardware components/devices used in an internetwork. Explain ALOHA in details. What is layering? Discuss the design issues for layers. Draw and explain the architecture and protocol stack of Bluetooth. Describe VLAN in details. Describe Error Detection and Correction techniques. Compare the TCP/IP and OSI refernce models. Explain CSMA protocol. Explain how collisions are handles in CSMA/CD. Explain Encapsulation and Decapsulation in details. Explain Unicasting, Multicasting and Mroadcasting. Explain different framing methods. List and explain different control access protocol. Explain and compare the following: Ethernet, token bus and token ring.

wireless program 3 run

# Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 5 ;# number of mobilenodes set val(rp) DSDV ;# routing protocol set val(x) 1000 ;# X dimension of topography set val(y) 1000 ;# Y dimension of topography set val(stop) 30 ;# time of simulation end # Define options set ns [new Simulator] set tracefd [open simple.tr w] set namtrace [open simwrls.nam w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -mac

new sample program

# Simulator Instance Creation set ns [new Simulator] #Fixing the co-ordinate of simutaion area set val(x) 500 set val(y) 500 # Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 2 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 400 ;# Y dimension of topography set val(stop) 10.0 ;# time of simulation end # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) #Nam File Creation nam – network animator set namfile [open sample1.nam w] #Tracing all the events and cofiguration $ns namtrace-a

wireless topology program

#-------Event scheduler object creation--------# set ns [new Simulator] # Creating trace file and nam file set tracefd [open wireless1.tr w] set namtrace [open wireless1.nam w]   $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) set god_ [create-god $val(nn)] # configure the nodes         $ns node-config -adhocRouting $val(rp) \                    -llType $val(ll) \                    -macType $val(mac) \                    -ifqType $val(ifq) \                    -ifqLen $val(ifqlen) \                    -antType $val(ant) \                    -propType $val(prop) \                    -phyType $val(netif) \                    -channelType $val(chan) \                    -topoInstance $topo \                    -agentTrace ON \                    -routerTrace ON \                    -macTrace OFF \                    -movementTrace ON                    ## Creating node obj

RSA Algorithm

import java.io.DataInputStream; import java.io.IOException; import java.math.BigInteger; import java.util.Random; public class RSA {     private BigInteger p;     private BigInteger q;     private BigInteger N;     private BigInteger phi;     private BigInteger e;     private BigInteger d;     private int bitlength = 1024;     private Random r;     public RSA()     {         r = new Random();         p = BigInteger.probablePrime(bitlength, r);         q = BigInteger.probablePrime(bitlength, r);         N = p.multiply(q);         phi = p.subtract(BigInteger.ONE).multiply(q.subtract(BigInteger.ONE));         e = BigInteger.probablePrime(bitlength / 2, r);         while (phi.gcd(e).compareTo(BigInteger.ONE) > 0 && e.compareTo(phi) < 0)         {             e.add(BigInteger.ONE);         }         d = e.modInverse(phi);     }     public RSA(BigInteger e, BigInteger d, BigInteger N)     {         this.e = e;         this.d = d;         this.N = N;     }     @SuppressWarning

Routing Algorithm in NS2

#Create a simulator object set ns [new Simulator] #Tell the simulator to use dynamic routing $ns rtproto DV #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} {         global ns nf         $ns flush-trace     #Close the trace file         close $nf     #Execute nam on the trace file         exec nam out.nam &         exit 0 } #Create seven nodes for {set i 0} {$i < 7} {incr i} {         set n($i) [$ns node] } #Create links between the nodes for {set i 0} {$i < 7} {incr i} {         $ns duplex-link $n($i) $n([expr ($i+1)%7]) 1Mb 10ms DropTail } #Create a UDP agent and attach it to node n(0) set udp0 [new Agent/UDP] $ns attach-agent $n(0) $udp0 # Create a CBR traffic source and attach it to udp0 set cbr0 [new Application/Traffic/CBR] $cbr0 set packetSize_ 500 $cbr0 set interval_ 0.005 $cbr0 attach-agent $udp0 #Create a Null agent (a traffic sink) and attach it to node n(3) set null0 [new Agent/Null] $ns at

Assignment 1 COMPUTER NETWORKS [Last Date : 30 August 2016]

1. With a neat diagram compare the uses and functions of differnet hardware components/devices used in an internetwork. ( 1.a :May -12, 1.a :Dec -12, Marks 10) 2. Explain ALOHA in details. ( 1.c :May -12 , Marks 10) 3. What is layering? Discuss the design issues for layers. (1.a :May -13, Marks 10) 4. Explain the ISO- OSI network model and discuss the functions of each layer. (1.b :May -11, Marks 12) 5. Compare the TCP/IP and OSI refernce models. (1.b :May -11, 1.aDec -14, Marks 10) 6. Explain the modes of propogating light along optical channels. What are the advantages over other guided media. (1.b :Dec -14, Marks 10) 7. Draw and explain the architecture and protocol stack of Bluetooth. ( 7.c :Dec -11, 7.c :May -13, Marks 5/10) 8. Explain different framing methods. What are the advatages at variable length frames over fixed length frames. (1.b :May -11, 2.a :May -13, Marks 10) 9. Why is the flow control needed? What are the mechanisms? Explain how the Go-Back-N and Selective

sample tcl program

#Create a simulator object set ns [new Simulator] #Define different colors for data flows $ns color 1 Green $ns color 2 Red #Open the nam trace file set nf [open out.nam w] $ns namtrace-all $nf #Define a 'finish' procedure proc finish {} {         global ns nf         $ns flush-trace     #Close the trace file         close $nf     #Execute nam on the trace file         exec nam out.nam &         exit 0 } #Create four nodes set n0 [$ns node] set n1 [$ns node] set n2 [$ns node] set n3 [$ns node] #Create links between the nodes $ns duplex-link $n0 $n2 1Mb 10ms DropTail $ns duplex-link $n1 $n2 1Mb 10ms DropTail $ns duplex-link $n3 $n2 1Mb 10ms SFQ $ns duplex-link-op $n0 $n2 orient right-down $ns duplex-link-op $n1 $n2 orient right-up $ns duplex-link-op $n2 $n3 orient right #Monitor the queue for the link between node 2 and node 3 #$ns duplex-link-op $n2 $n3 queuePos 0.5 $ns duplex-link-op $n0 $n2 queuePos 0.5 #Create a UDP agent and attach it to node n0 set udp0 [new Agent/UDP