• 大小: 14KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-11
  • 语言: C/C++
  • 标签: 协议  算法  

资源简介

这是个实现数据链路层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

评论

共有 条评论