Showing posts with label EC66. Show all posts
Showing posts with label EC66. Show all posts

Sunday, January 26, 2014

AnnaUniversity EC66 Computer Networks Lab - Implementation of Virtual Local Area Network(VLAN) using Packet Tracer

with 0 Comment
Implementation of Virtual Local Area Network VLAN using Packet Tracer:
S1>enable
S1#Configure terminal
S1(config)#interface vlan 1
S1(config-if)#ip address 192.168.1.10 255.255.255.0
S1(config-if)#no shutdown
S1(config-if)#exit

S2>enable
S2#Configure terminal
S2(config)#interface vlan 1
S2(config-if)#ip address 192.168.1.11 255.255.255.0
S2(config-if)#no shutdown
S2(config-if)#exit

S3>enable
S3#Configure terminal
S3(config)#interface vlan 1
S3(config-if)#ip address 192.168.1.12 255.255.255.0
S3(config-if)#no shutdown
S3(config-if)#exit

S1>enable
S1#Configure terminal
S1(config)#interface Fa0/1
S1(config-if)#switchport mode trunk
S1(config-if)#exit

S1>enable
S1#Configure terminal
S1(config)#interface Fa0/2
S1(config-if)#switchport mode trunk
S1(config-if)#exit

S2>enable
S2#Configure terminal
S2(config)#interface Fa0/1
S2(config-if)#switchport mode trunk
S2(config-if)#exit

S2>enable
S2#Configure terminal
S2(config)#interface range Fa0/2 - 4
S2(config-if)#switchport mode access
S2(config-if)#exit

S3>enable
S3#Configure terminal
S3(config)#interface range Fa0/1
S3(config-if)#switchport mode trunk
S3config-if)#exit

S3>enable
S3#Configure terminal
S3(config)#interface range Fa0/2 - 4
S3(config-if)#switchport mode access
S3(config-if)#exit

CONFIGURING VLAN TRUNKING PROTOCOL (VTP):

S1>enable
S1#Configure terminal
S1(config)#vtp domain NEC
S1(config)#exit

CONFIGURING VLAN 10,20 & 30
S1>enable
S1#Configure terminal
S1(config)#vlan 10
S1(config-vlan)#name ECE
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#vlan 20
S1(config-vlan)#name CSE
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#vlan 30
S1(config-vlan)#name EEE
S1(config)#exit


S1>enable
S1#Configure terminal
S1(config)#interface vlan 10
S1(config-vlan)#ip address 192.168.20.1 255.255.255.0
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#interface vlan 20
S1(config-vlan)#ip address 192.168.30.1 255.255.255.0
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#interface vlan 30
S1(config-vlan)#ip address 192.168.40.1 255.255.255.0
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#interface vlan 10
S1(config-vlan)#ip address 192.168.20.1 255.255.255.0
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#interface vlan 20
S1(config-vlan)#ip address 192.168.30.1 255.255.255.0
S1(config)#exit

S1>enable
S1#Configure terminal
S1(config)#interface vlan 30
S1(config-vlan)#ip address 192.168.40.1 255.255.255.0
S1(config)#exit


CONFIGURING VLAN  TO PC’S:

PC1 – VLAN 10 - 192.168.20.20
PC2 – VLAN 20 - 192.168.30.20
PC3 – VLAN 30 - 192.168.40.20

PC4 – VLAN 10 - 192.168.20.21
PC5 – VLAN 20 - 192.168.30.21
PC6 – VLAN 30 - 192.168.40.21

AnnaUniversity EC66 Computer Networks Lab - Simulation of Wireless Environment Using NS-2

with 0 Comment
Simulation of Wireless Environment Using NS-2:


# 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)              3                          ;# 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) 150   ;# time of simulation end
#=====================================================================
# Main Program
#======================================================================
#
# Initialize Global Variables
#
# create simulator instance
set ns_ [new Simulator]
# setup topography object
set topo [new Topography]
# define topology
$topo load_flatgrid $val(x) $val(y)
# create trace object for ns and nam
set tracefd [open out.tr w]
$ns_ trace-all $tracefd
$ns_ use-newtrace
set namtrace    [open out.nam w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)

#
# Create God
#
set god_ [create-god $val(nn)]
#
# define how node should be created
#
# 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   for {set i 0} {$i < $val(nn) } { incr i } { set node_($i) [$ns_ node] }
# Provide initial location of mobilenodes $node_(0) set X_ 5.0 $node_(0) set Y_ 5.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 490.0 $node_(1) set Y_ 285.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 150.0 $node_(2) set Y_ 240.0 $node_(2) set Z_ 0.0  # Generation of movements $ns_ at 10.0 "$node_(0) setdest 250.0 250.0 3.0" $ns_ at 15.0 "$node_(1) setdest 45.0 285.0 5.0" $ns_ at 110.0 "$node_(0) setdest 480.0 300.0 5.0"
# Set a TCP connection between node_(0) and node_(1) set tcp [new Agent/TCP/Newreno] set sink [new Agent/TCPSink] $ns_ attach-agent $node_(0) $tcp $ns_ attach-agent $node_(1) $sink $ns_ connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp

#Application start & stop time
$ns_ at 60.0 "$ftp start"
$ns_ at 90.0 "$ftp stop"

# Define node initial position in nam
for {set i 0} {$i < $val(nn)} { incr i } { # 30 defines the node size for nam $ns_ initial_node_pos $node_($i) 30 }
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {    $ns_ at $val(stop) "$node_($i) reset"; }  $ns_ run

AnnaUniversity EC66 Computer Networks Lab - Simulation of Wired Environment Using NS-2

with 0 Comment
Simulation of Wired Environment Using NS-2:

set ns [new Simulator]
set tr [open out.tr w]
$ns trace-all $tr
set namtr [open out.nam w]
$ns namtrace-all $namtr
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
$ns color 1 black
$ns color 2 green
$ns duplex-link $n0 $n1 10Mb 5ms DropTail
$ns duplex-link $n2 $n0 10Mb 5ms DropTail
$ns duplex-link $n3 $n0 10Mb 5ms DropTail
$ns duplex-link $n1 $n4 10Mb 5ms DropTail
$ns duplex-link $n1 $n5 10Mb 5ms DropTail
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n0 $n2 orient left-up
$ns duplex-link-op $n0 $n3 orient left-down
$ns duplex-link-op $n1 $n4 orient right-up
$ns duplex-link-op $n1 $n5 orient right-down
$ns at 10.0 "$ns halt"
set udp0 [new Agent /UDP]
set tcp1 [new Agent /TCP]
$ns attach-agent $n0 $udp0
$ns attach-agent $n0 $tcp1
set null0 [new Agent /NULL]
set null1 [new Agent /TCPSink]
$ns attach-agent $n4 $null0
$ns attach-agent $n5 $null1
$ns connect $udp0 $null0
$udp0 set fid_ 1
$ns connect $tcp1 $null1
$tcp1 set fid_ 2
set cbr0 [new Application /Traffic /CBR]
set cbr1 [new Application /Traffic /CBR]
$cbr0 attach-agent $udp0
$cbr1 attach-agent $tcp1
$cbr0 set packetsize_ 512
$cbr1 set packetsize_ 512
$cbr0 set interval_ 0.01
$cbr1 set interval_ 0.01
$ns at 1.0 "$cbr0 start"
$ns at 5.0 "$cbr0 stop"
$ns at 2.0 "$cbr1 start"
$ns at 7.0 "$cbr1 stop"
$ns run


AnnaUniversity EC66 Computer Networks Lab - Implementation of Link State Routing Protocol(LSRP) on Router

with 0 Comment
Link  State Routing  Protocol:

Router 0

ss>en
ss#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ss(config)#hostname ss
ss(config)#nt s2/0
                 ^
% Invalid input detected at '^' marker.
               
ss(config)#int s2/0
ss(config-if)#ip address 192.168.5.1 255.255.255.252
ss(config-if)#clock rate 64000
ss(config-if)#no shutdown
ss(config-if)#exit
ss(config)#int fo/0
                     ^
% Invalid input detected at '^' marker.
               
ss(config)#int f0/0
ss(config-if)#ip address 192.168.5.129 255.255.255.192
ss(config-if)#no shutdown
ss(config-if)#exit
ss(config)#en
% Ambiguous command: "en"
ss(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ss(config)#router OSPF 1
ss(config-router)#network 192.168.5.0 0.0.0.3 area 0
ss(config-router)#network 192.168.5.128 0.0.0.63 area0
                                                          ^
% Invalid input detected at '^' marker.
               
ss(config-router)#network 192.168.5.0 0.0.0.3 area 0
ss(config-router)#exit
ss(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss#en
ss#copy ru st
Destination filename [startup-config]?
Building configuration...
[OK]
ss#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.5.0/30 is directly connected, Serial2/0
C       192.168.5.128/26 is directly connected, FastEthernet0/0
Router 1
ss1>en
ss1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ss1(config)#hostname ss1
ss1(config)#int s2/0
ss1(config-if)#ip address 192.168.5.1 255.255.255.252
ss1(config-if)#clock rate 64000
ss1(config-if)#no shutdown
ss1(config-if)#exit
ss1(config)#int f0/0
ss1(config-if)#ip address 192.168.5.129 255.255.192
                                             ^
% Invalid input detected at '^' marker.
               
ss1(config-if)#ip address 192.168.5.129 255.255.255.192
ss1(config-if)#no shutdown
ss1(config-if)#exit
ss1(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
ss1(config)#router OSPF 1
ss1(config-router)#network 192.168.5.0 0.0.0.3 area 0
ss1(config-router)#network 192.168.6.1 0.0.0.255 area 0
ss1(config-router)#exit
ss1(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss1#copy ru st
Destination filename [startup-config]?
Building configuration...
[OK]
ss1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

          192.168.5.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.5.0/30 is directly connected, Serial2/0
C       192.168.5.128/26 is directly connected, FastEthernet0/0

ss1#ss#

AnnaUniversity EC66 Computer Networks Lab - Implementation of Distance Vector Routing Protocol(DVRP) on Router

with 0 Comment
System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1)
Copyright (c) 2000 by cisco Systems, Inc.
PT 1001 (PTSC2005) processor (revision 0x200) with 60416K/5120K bytes of memory

Self decompressing the image :
########################################################################## [OK]

              Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706

Cisco Internetwork Operating System Software
IOS (tm) PT1000 Software (PT1000-I-M), Version 12.2(28), RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 27-Apr-04 19:01 by miwang

PT 1001 (PTSC2005) processor (revision 0x200) with 60416K/5120K bytes of memory
.
Processor board ID PT0123 (0123)
PT2005 processor: part number 0, mask 01
Bridging software.
X.25 software, Version 3.0.0.
4 FastEthernet/IEEE 802.3 interface(s)
2 Low-speed serial(sync/async) network interface(s)
32K bytes of non-volatile configuration memory.
16384K bytes of processor board System flash (Read/Write)

         --- System Configuration Dialog ---

Continue with configuration dialog? [yes/no]: no

Press RETURN to get started!

Router>enable
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host name ss
                         ^
% Invalid input detected at '^' marker.

Router(config)#hostname ss
ss(config)#interface s2/0
ss(config-if)#ip address 172.17.0.1 255.0.0.0
ss(config-if)#clock rate 64000
ss(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to down
ss(config-if)#exit
ss(config)#interface f0/0
ss(config-if)#ip address 14.0.0.1 255.0.0.0
ss(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ss(config-if)#exit
ss(config)#router rip
ss(config-router)#network 172.160.0.0
ss(config-router)#exit
ss(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss#copy ru st
Destination filename [startup-config]?
Building configuration...
[OK]
ss#

for router 2
System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1)
Copyright (c) 2000 by cisco Systems, Inc.
PT 1001 (PTSC2005) processor (revision 0x200) with 60416K/5120K bytes of memory

Self decompressing the image :
########################################################################## [OK]

              Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

           cisco Systems, Inc.
           170 West Tasman Drive
           San Jose, California 95134-1706

Cisco Internetwork Operating System Software
IOS (tm) PT1000 Software (PT1000-I-M), Version 12.2(28), RELEASE SOFTWARE (fc5)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 27-Apr-04 19:01 by miwang

PT 1001 (PTSC2005) processor (revision 0x200) with 60416K/5120K bytes of memory
.
Processor board ID PT0123 (0123)
PT2005 processor: part number 0, mask 01
Bridging software.
X.25 software, Version 3.0.0.
4 FastEthernet/IEEE 802.3 interface(s)
2 Low-speed serial(sync/async) network interface(s)
32K bytes of non-volatile configuration memory.
16384K bytes of processor board System flash (Read/Write)

         --- System Configuration Dialog ---

Continue with configuration dialog? [yes/no]: no

Press RETURN to get started!

Router>enable
Router#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host name ss
                         ^
% Invalid input detected at '^' marker.

Router(config)#hostname ss
sss(config)#interface s2/0
sss(config-if)#ip address 172.17.0.1 255.0.0.0
sss(config-if)#clock rate 64000
sss(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to down
sss(config-if)#exit
sss(config)#interface f0/0
sss(config-if)#ip address 14.0.0.1 255.0.0.0
sss(config-if)#no shutdown

%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
sss(config-if)#exit
sss(config)#router rip
sss(config-router)#network 172.160.0.0
sss(config-router)#exit
sss(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
ss#copy ru st
Destination filename [startup-config]?
Building configuration...
[OK]
ss#

AnnaUniversity EC66 Computer Networks Lab - C Program to Compute Utilization of Token Ring Protocol for Normal Token Release(NTR) and Early Token Release(ETR)

with 0 Comment
Study and Implementation of Token Ring Protocol:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define v 2.0e8
void main(void)
{
char instring[80];
double d,r,a,u;
long int l,n,releasetype;
clrscr();
printf("....................");
printf("\n Program to Compute Utiliation of Token Ring Protocol\n");
printf("\n.....................\n");
printf("\n Length of the link in m:");
scanf("%s",instring);
d=atof(instring);
printf("\n Data rate of the link in bits per sec");
scanf("%s",instring);
r=atof(instring);
printf("\n Size of frame in byte:");
scanf("%s",instring);
l=8*atoi(instring);
printf("\n no of stations");
scanf("%s",instring);
n=atoi(instring);
printf("token ring release type1=ntr,type2=etr");
printf("\n Enter the value for ntr,etr");
scanf("%s",instring);
releasetype=atoi(instring);
a=((double)r*d)/((double)v*l);
if(releasetype==1);
{
printf("Normal token release");
if(a<=1.0)
u=1.0/(1.0+(a/n));
else
u=1.0/(a*(1.0+(a/n)));
}
if(releasetype==2)
{
printf("Early token release");
u=1.0/(1.0+(a/n));
}
printf(".........a=%f\n",a);
printf(".........u=%f%f\n",100.00*u);
printf(".............");
getch();
}

OUTPUT:

a<1 :

a>1:

AnnaUniversity EC66 Computer Networks Lab - C Program to Calculate the Link Utilization for Selective Repeat or Selective Reject ARQ Protocol

with 0 Comment
C Program to Calculate the Link Utilization for Selective Repeat or Selective Reject ARQ Protocol:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define v 2.0e8
void main(void)
{
char instring[80];
double d,r,pr,p,a,u;
long int l,n;
clrscr();
printf("....................");
printf("\n Program to Compute Utiliation of Selective Repeat N ARQ protocol\n");
printf("\n.....................\n");
printf("\n Length of the link in m:");
scanf("%s",instring);
d=atof(instring);
printf("\n Data rate of the link in bits per sec");
scanf("%s",instring);
r=atof(instring);
printf("\n Size of frame in byte:");
scanf("%s",instring);
l=8*atoi(instring);
printf("\n pr[biterror](0.0to1.0):");
scanf("%s",instring);
pr=atof(instring);
printf("\n size of window");
scanf("%s",instring);
n=atoi(instring);
p=1-pow((1-pr),(double)l);
a=((double)(r*d))/((double)v*l);
if(n>=((2*a)+1))
u=(1-p);
else
u=(n*(1-p))/(1+(2*a));
printf("\n.................\n");
printf("\n Protocol is Selective Repeat or Selective Reject N ARQ\n");
printf("\n......a=%f.....\n",a);
printf("\n......pr[frameloss]=%f......\n",p);
printf("\n......u=%f.......\n",100.0*u);
printf("\n.................\n");
getch();
}

OUTPUT:


AnnaUniversity EC66 Computer Networks Lab - C Program to Calculate the Link Utilization for GO BACK N ARQ Protocol

with 0 Comment
C Program to Calculate the Link Utilization for GO BACK N ARQ Protocol:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define v 2.0e8
void main(void)
{
char instring[80];
double d,r,pr,p,a,u;
long int l,n;
clrscr();
printf("....................");
printf("\n Program to Compute Utiliation of GO BACK N ARQ Protocol\n");
printf("\n.....................\n");
printf("\n Length of the link in m:");
scanf("%s",instring);
d=atof(instring);
printf("\n Data rate of the link in bits per sec");
scanf("%s",instring);
r=atof(instring);
printf("\n Size of frame in byte:");
scanf("%s",instring);
l=8*atoi(instring);
printf("\n pr[biterror](0.0to1.0):");
scanf("%s",instring);
pr=atof(instring);
printf("\n size of window");
scanf("%s",instring);
n=atoi(instring);
p=1-pow((1-pr),(double)l);
a=((double)(r*d)/((double)v*l));
if(n>=((2*a)+1))
u=(1-p)/(1+(2*a*p));
else
u=(n*(1-p))/(((2*a)+1)*(1-p+n*p));
printf("\n.................\n");
printf("\n Protocol is Sliding Window GO BACK N ARQ\n");
printf("\n......a=%f.....\n",a);
printf("\n......pr[frameloss]=%f......\n",p);
printf("\n......u=%f.......\n",100.0*u);
printf("\n.................\n");
getch();
}

OUTPUT:


AnnaUniversity EC66 Computer Networks Lab - C Program to Calculate the Link Utilization for Stop and Wait ARQ Protocol

with 0 Comment
C Program to Calculate the Link Utilization for Stop and Wait ARQ Protocol:

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<math.h>
#define v 2.0e8
void main(void)
{
char instring[80];
double d,r,pr,p,a,u,u1;
long int l;
clrscr();
printf("....................");
printf("\n Program to Compute Utiliation of Stop and Wait Protocol\n");
printf("\n.....................\n");
printf("\n Length of the link in m:");
scanf("%s",instring);
d=atof(instring);
printf("\n Data rate of the link in bits per sec");
scanf("%s",instring);
r=atof(instring);
printf("\n Size of frame in byte:");
scanf("%s",instring);
l=8*atoi(instring);
printf("\n pr[biterror](0.0to1.0):");
scanf("%s",instring);
pr=atof(instring);
p=1-pow((1-pr),(double)l);
a=((double)r*d)/((double)v*l);
u=(1-p)/(1+(2*a));
u1=(1)/(1+(2*a));
printf("\n...................\n");
printf("\n.....Protocol is Stop and Wait....\n");
printf("......a=%f.........\n",a);
printf("......pr[frameloss]=%f....\n",p);
printf(".....Utilisation Factor with Error=%f....\n",100.0*u);
printf(".....Utilisation Factor without Error=%f....\n",100.0*u1);
printf("................\n");
getch();
}

OUTPUT:


AnnaUniversity EC66 Computer Networks Lab - PC to PC Serial Communication

with 0 Comment
PC to PC Serial Communication:

#include <bios.h>
#include <conio.h>

#define COM1       0
#define DATA_READY 0x100
#define TRUE       1
#define FALSE      0

#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)

int main(void)
{
   int in, out, status, DONE = FALSE;

   bioscom(0, SETTINGS, COM1);
   cprintf("... BIOSCOM [ESC] to exit ...\n");
   while (!DONE)
   {
      status = bioscom(3, 0, COM1);
      if (status & DATA_READY)
         if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
            putch(out);
         if (kbhit())
         {
            if ((in = getch()) == '\x1B')
               DONE = TRUE;
            bioscom(1, in, COM1);
         }
   }
   return 0;
}

Powered by Blogger.