資源簡介
這是個實現數據鏈路層6大協議的程序 ,他是用c語言編寫的

代碼片段和文件信息
/*?Protocol?1?(utopia)?provides?for?data?transmission?in?one?direction?only?from
???sender?to?receiver.??The?communication?channel?is?assumed?to?be?error?free
???and?the?receiver?is?assumed?to?be?able?to?process?all?the?input?infinitely?quickly.
???Consequently?the?sender?just?sits?in?a?loop?pumping?data?out?onto?the?line?as
???fast?as?it?can.?*/
typedef?enum?{frame_arrival}?event_type;
#include?“protocol.h“
void?sender1(void)
{
??frame?s; /*?buffer?for?an?outbound?frame?*/
??packet?buffer; /*?buffer?for?an?outbound?packet?*/
??while?(true)?{
????????from_network_layer(&buffer); /*?go?get?something?to?send?*/
????????s.info?=?buffer; /*?copy?it?into?s?for?transmission?*/
????????to_physical_layer(&s); /*?send?it?on?its?way?*/
??} /*?Tomorrow?and?tomorrow?and?tomorrow
? ???Creeps?in?this?petty?pace?from?day?to?day
???To?the?last?syllable?of?recorded?time.
????????-?Macbeth?V?v?*/
}
void?receiver1(void)
{
??frame?r;
??event_type?event; /*?filled?in?by?wait?but?not?used?here?*/
??while?(true)?{
????????wait_for_event(&event); ?/*?only?possibility?is?frame_arrival?*/
????????from_physical_layer(&r);?/*?go?get?the?inbound?frame?*/
????????to_network_layer(&r.info);?/*?pass?the?data?to?the?network?layer?*/
??}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1247??2002-07-29?16:31??Fig-3-10.c
?????文件????????1408??2002-07-29?16:31??Fig-3-11.c
?????文件????????2166??2002-07-29?18:03??Fig-3-12.c
?????文件????????2091??2002-07-29?16:31??Fig-3-14.c
?????文件????????4185??2002-07-29?16:30??Fig-3-17.c
?????文件????????5569??2002-07-29?18:05??Fig-3-19.c
?????文件????????1800??2002-07-29?16:17??Fig-3-9
?????文件????????1730??2002-07-29?17:45??Fig-5-8.c
?????文件????????8002??2002-07-29?18:12??Fig-6-20.c
?????文件????????1698??2002-07-29?18:06??Fig-6-6-client.c
?????文件????????1900??2002-07-29?18:11??Fig-6-6-server.c
?????文件????????1037??2002-07-29?18:16??Fig-8-9.c
?????文件?????????147??2002-06-12?09:33??Makefile
?????文件????????1790??2002-07-27?14:13??protocol.h
- 上一篇:純C語言寫的打字母游戲
- 下一篇:可變分區存儲管理方式的內存分配與回收(C++)
評論
共有 條評論