資源簡(jiǎn)介
許多數(shù)據(jù)與計(jì)算機(jī)網(wǎng)絡(luò)通信中的協(xié)議程序,如CSMA/CD CA巖石等等程序
代碼片段和文件信息
///////////////////////////////////////
//LineSimApllet
//written?by?David?Grangier?Institut?Eurecom?France
//david.grangier@eurecom.fr
///////////////////////////////////////
package?linesim;
//imports
import?java.awt.*;
import?java.awt.event.*;
import?java.awt.image.*;
import?java.applet.*;
import?java.util.*;
//applet?Class
public?class?LineSimapplet?extends?applet?{
//buttons
Button?start=new?Button?(“Start“);
Button?stop=new?Button?(“Reset“);
//features?lists
MyChoice?length=new?MyChoice(new?String[]?{“10?km““100?km““1000?km“}new?double[]?{10E3100E31E6}3);
MyChoice?rate=new?MyChoice(new?String[]?{“512?kps““1?Mbps““10?Mbps““100?Mbps“}new?double[]?{512E31E610E6100E6}2);
MyChoice?size=new?MyChoice(new?String[]?{“100?Bytes““500?Bytes““1?kBytes“}new?double[]?{8E24E38E3}1);
//to?simulate?time
Thread?timerThread;
TickTask?timerTask;
boolean?simulationRunning=false;
//communication?line
Line?myLine;
public?void?init()?{
??try?{
????setBackground(Color.white);
????add(new?Label?(“Length“Label.RIGHT));
????add(length);
????add(new?Label(“Rate“Label.RIGHT));
????add(rate);
????add(new?Label(“Packet?size“Label.RIGHT));
????add(size);
????//start
????start.addActionListener(
??????new?ActionListener()
??????{
????????public?void?actionPerformed?(ActionEvent?event)
????????{
??????????launchSim();
????????}
??????});
????add(start);
????//stop
????Button?stop=new?Button?(“Reset“);
????stop.addActionListener(
??????new?ActionListener()
??????{
????????public?void?actionPerformed?(ActionEvent?event)
????????{
??????????stopSim();
??????????//clear?line
??????????myLine.sendTime(0);
??????????//redraw?cleared?line
??????????LineSimapplet.this.repaint();
????????}
??????});
????add(stop);
????//line
????myLine=?new?Line(405045010);
??}
??catch(Exception?e)?{
????e.printStackTrace();
??}
}
public?void?paint?(Graphics?g)
{
??update(g);?//?eliminate?flashing?:?update?is?overriden
}
public?void?update?(Graphics?g)
{?//work?on?a?offscreen?image
??Dimension?offDimension?=?getSize();
??Image?offImage?=?createImage(offDimension.width?offDimension.height);
??Graphics?offGraphics?=?offImage.getGraphics();
??myLine.drawLine(offGraphics);
??//sender
??offGraphics.setColor(Color.blue);
??offGraphics.fillRect(10403030);
??offGraphics.setColor(Color.black);
??offGraphics.drawString(“Sender“590);
??offGraphics.drawRect(10403030);
??//receiver
??offGraphics.setColor(Color.blue);
??offGraphics.fillRect(490403030);
??offGraphics.setColor(Color.black);
??offGraphics.drawString(“Receiver“48590);
??offGraphics.drawRect(490403030);
??offGraphics.drawString(“Propagation?speed?:?2.8?x?10^8?m/sec“175105);
??//display?offscreen?image
??g.drawImage(offImage?0?0?this);
}
private?void?launchSim()
{
??setupEnabled(false);
??//setup?line
??myLine.setup(length.getVal()?rate.getVal()?);
??myLine.emitPacket(size.getVal()0);
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\ack.gif
?????文件???????1815??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\ba
?????文件????????966??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\bs.gif
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\busy.gif
?????文件????????932??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Channel.class
?????文件????????508??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Csma_ca_ap
?????文件????????917??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Csma_ca_ap
?????文件???????4018??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Csma_ca_ap
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\ctdn.gif
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\cts.gif
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\free.gif
?????文件???????3276??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\hiddenTerConf.gif
?????文件???????3438??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\MobileStation.class
?????文件????????945??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\ms.gif
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\nav.gif
?????文件???????1038??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Packet.class
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\pkt.gif
?????文件????????799??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\rts.gif
?????文件????????611??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Scenario$1.class
?????文件???????3122??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Scenario.class
?????文件???????1515??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\SimTimer.class
?????文件???????1538??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\Terminal.class
?????文件???????1522??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\TimeLine.class
?????文件???????3598??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\withhidden.html
?????文件????????382??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\ack.gif
?????文件????????179??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\ba
?????文件????????384??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\bs.gif
?????文件????????382??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\busy.gif
?????文件????????178??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\Channel.class
?????文件????????255??2007-02-08?09:38??網(wǎng)絡(luò)原理動(dòng)畫\pearsoncmg11\_vti_cnf\Csma_ca_ap
............此處省略230個(gè)文件信息
評(píng)論
共有 條評(píng)論