Part B Program1_3

download Part B Program1_3

of 2

Transcript of Part B Program1_3

  • 8/9/2019 Part B Program1_3

    1/2

    Network Lab Manual Part B : Page No:1 NH/CS

    Experiment No 3: Distance Vector RoutingProblem Statement: Write a program for distance vector algorithm to find suitable path for transmission.Program

    #include #include int main()

    {int d[10][10], a[10][10],i,j,n ,k,min=999cha! "= $ ,b= $ ,c= $

    %!int&(' nte! the numbe! o& nodes n')scan&('*d',+n)

    %!int&(' nte! the in%ut a!!a mat!i" n')&o!(i=0 i

  • 8/9/2019 Part B Program1_3

    2/2

    Network Lab Manual Part B : Page No:2 NH/CS

    Output[nags@localhost NPL]$ ./a.out

    nte! the numbe! o& nodes5

    nte! the in%ut a!!a mat!i"0 6 7 16 0 7 77 7 0 81 7 8 0

    nte! the sou!ce node/8

    outin2 table &o! sou!ce node 3> $=1 4ode=$ 3> :=7 4ode=: 3> ;=8 4ode=; 3> =0 4ode=

    Theoryout!ng algor!thm !" a part o# network layer "o#tware wh!$h !" re"pon"!ble #or %e$!%!ng wh!$h output l!ne an

    !n$om!ng pa$ket "houl% be tran"m!tte% on& '# the "ubnet u"e" %atagram !nternally( th!" %e$!"!on mu"t be ma%e anew #or e)ery arr!)!ng %ata pa$ket "!n$e the be"t route may ha)e $hange% "!n$e la"t t!me& '# the "ubnet u"e" )!rtual $!r$u!t"!nternally( rout!ng %e$!"!on" are ma%e only when a new e"tabl!"he% route !" be!ng "et up& The latter $a"e !" "omet!me"$alle% "e""!on rout!ng( be$au"e a rout rema!n" !n #or$e #or an ent!re u"er "e""!on &

    Two algor!thm" !n part!$ular( %!"tan$e )e$tor rout!ng an% l!nk "tate rout!ng are the mo"t popular& *!"tan$e )e$tor rout!ng algor!thm" operate by ha)!ng ea$h router ma!nta!n a table +!&e&( )e$tor, g!)!ng the be"t known %!"tan$e to ea$h%e"t!nat!on an% wh!$h l!ne to get there& The"e table" are up%ate% by e-$hang!ng !n#ormat!on w!th the ne!ghbor"&

    The %!"tan$e )e$tor rout!ng algor!thm !" "omet!me" $alle% by other name"( !n$lu%!ng the %!"tr!bute% Bellman. or%rout!ng algor!thm an% the Ford Ful!erson algor!thm( a#ter the re"ear$her" who %e)elope% !t +Bellman( 10 3 an% or%an% ulker"on( 1042,& 't wa" the or!g!nal 5 P5N6T rout!ng algor!thm an% wa" al"o u"e% !n the 'nternet un%er the 'P

    an% !n early )er"!on" o# *6Cnet an% No)ell7" 'P8& 5ppleTalk an% C!"$o router" u"e !mpro)e% %!"tan$e )e$tor proto$ol"&

    'n %!"tan$e )e$tor rout!ng( ea$h router ma!nta!n" a rout!ng table !n%e-e% by( an% $onta!n!ng one entry #or( ea$hrouter !n "ubnet& Th!" entry $onta!n" two part": the pre#erre% out go!ng l!ne to u"e #or that %e"t!nat!on( an% an e"t!mateo# the t!me or %!"tan$e to that %e"t!nat!on& The metr!$ u"e% m!ght be number o# hop"( t!me %elay !n m!ll!"e$on%"( totalnumber o# pa$ket" 9ueue% along the path( or "ometh!ng "!m!lar&

    The router !" a""ume% to know the %!"tan$e; to ea$h o# !t" ne!ghbor& '# the metr!$ !" hop"( the %!"tan$e !"