資源簡介
一個利用OMNET實現(xiàn)的經(jīng)典令牌環(huán)模型,初學者可以學習,直接點擊EXE文件可以運行

代碼片段和文件信息
#include?
#include?“token_m.h“
#define?STACKSIZE?16384
class?Generator?:?public?cSimpleModule
{
??public:
????Generator()?:?cSimpleModule(STACKSIZE)?{}
????virtual?void?activity();
};
Define_Module(?Generator?);
void?Generator::activity()
{
????int?numMessages?=?par(“numMessages“);
????int?numStations?=?par(“numStations“);
????cPar&?interArrivalTime?=?par(“interArrivalTime“);?
????cPar&?messageLength?=?par(“messageLength“);?
????int?myAddress?=?par(“address“);
????bool?debug=true;
????WATCH(debug);
????char?msgname[30];
????for?(int?i=0;?i ????{
????????int?length?=?(int)messageLength;
????????int?dest?=?intrand(numStations-1);
????????if?(dest>=myAddress)?dest++;
????????sprintf(msgname?“app%d-data%d“?myAddress?i);
????????TRApplicationData?*msg?=?new?TRApplicationData(msgname);
????????msg->setDestination(dest);
????????msg->setLength(8*length);
????????msg->setData(“here‘s?some?application?data...“);
????????if?(debug)
????????{
????????????ev?<“Generated?application?data?to?send:?\““?<??????????????????“l(fā)ength=“?<????????}
????????send(msg?“out“);
????????wait(?interArrivalTime?);
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1157??2017-12-19?23:13??令牌環(huán)模型\.tkenvrc
?????文件??????33792??2017-12-18?09:32??令牌環(huán)模型\Debug\vc60.idb
?????文件??????28672??2017-12-18?09:32??令牌環(huán)模型\Debug\vc60.pdb
?????文件???????1267??2017-12-16?22:36??令牌環(huán)模型\gen.cpp
?????文件???????3365??2017-12-18?09:32??令牌環(huán)模型\gen.dsp
?????文件????????514??2017-12-18?09:32??令牌環(huán)模型\gen.dsw
?????文件??????33792??2017-12-18?09:32??令牌環(huán)模型\gen.ncb
?????文件???????1070??2005-10-18?21:23??令牌環(huán)模型\gen.ned
?????文件??????48640??2017-12-18?09:32??令牌環(huán)模型\gen.opt
?????文件???????1336??2017-12-18?09:32??令牌環(huán)模型\gen.plg
?????文件???????5179??2017-12-19?23:09??令牌環(huán)模型\gen_n.cpp
?????文件???????9193??2017-12-19?23:09??令牌環(huán)模型\gen_n.obj
?????文件???????1635??2005-10-18?21:23??令牌環(huán)模型\Lcomputer.ned
?????文件???????7554??2017-12-19?23:09??令牌環(huán)模型\Lcomputer_n.cpp
?????文件??????28343??2017-12-19?23:09??令牌環(huán)模型\Lcomputer_n.obj
?????文件???????4396??2017-12-19?23:08??令牌環(huán)模型\Makefile.vc
?????文件???????1148??2005-10-18?21:23??令牌環(huán)模型\omnetpp.ini
?????文件???????5984??2017-12-19?23:13??令牌環(huán)模型\omnetpp.sca
?????文件???????1170??2017-12-16?22:35??令牌環(huán)模型\sink.cpp
?????文件????????526??2005-10-18?21:23??令牌環(huán)模型\sink.ned
?????文件???????4857??2017-12-19?23:09??令牌環(huán)模型\sink_n.cpp
?????文件???????8034??2017-12-19?23:09??令牌環(huán)模型\sink_n.obj
?????文件???????9876??2017-12-16?22:56??令牌環(huán)模型\token.cpp
?????文件???????3389??2017-12-18?09:32??令牌環(huán)模型\token.dsp
?????文件????????518??2017-12-18?09:32??令牌環(huán)模型\token.dsw
?????文件????????631??2005-10-18?21:23??令牌環(huán)模型\token.msg
?????文件??????41984??2017-12-18?09:32??令牌環(huán)模型\token.ncb
?????文件????????985??2005-10-18?21:23??令牌環(huán)模型\token.ned
?????文件??????48640??2017-12-18?09:32??令牌環(huán)模型\token.opt
?????文件???????1354??2017-12-18?09:32??令牌環(huán)模型\token.plg
............此處省略16個文件信息
- 上一篇:打印labview面板的曲線圖
- 下一篇:愛旅行完整接口文檔
評論
共有 條評論