SIMULATE
STOP AND WAIT ARQ
import java.applet.Applet;
import java.applet.*;
import java.awt.*;
public class STOP_WAIT extends Applet
{
public void init()
{
}
public void paint(Graphics g)
{
g.drawString("Sender",25,40);
g.drawString("Receiver",325,40);
g.drawRect(20,20,60,30);//sender Rectangle
g.drawLine(50,50,50,200);//sender Vertical line
g.drawRect(320,20,60,30);//Receiver Rectangle
g.drawLine(350,50,350,200);//receiver Vertical line
/*Line for Frame 0*/
g.drawLine(50,60,350,60 );
g.drawLine(350,60,50,100);
/*Line for Frame 1*/
g.drawLine(50,100,350,100 );
g.drawLine(350,100,50,140);
/*Line for Frame 2*/
g.drawLine(50,140,350,140 );
g.drawLine(350,140,50,180);
/*Line for Frame 3*/
g.drawLine(50,180,350,180 );
g.drawString("Frame 0",190,60);
g.drawString("Frame 1",190,100);
g.drawString("Frame 2",190,140);
g.drawString("Frame 3",190,180);
g.drawString("ACK 0",100,90);
g.drawString("ACK 1",100,130);
g.drawString("ACK 2",100,170);
g.drawString("S=0",25,65);
g.drawString("S=1",25,105);
g.drawString("S=0",25,145);
g.drawString("S=1",25,185);
g.drawString("R=0",360,65);
g.drawString("R=1",360,105);
g.drawString("R=0",360,145);
g.drawString("R=1",360,185);
}
}
--------------------------------------------------OUTPUT----------------------------------------------------