xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 3KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-05
  • 語言: C/C++
  • 標簽: GoBacKN??

資源簡介

實驗內容 設計一個滑動窗口協議,在仿真環境下編程實現有噪音信道兩站點間無差錯雙工通信 信道模型 8000bps全雙工衛星信道 單向傳播時延270毫秒 信道誤碼率為10-5 物理層接口:提供幀傳輸服務,幀間有1ms幀邊界 網絡層屬性:分組長度固定256字節 實現Go BackN協議

資源截圖

代碼片段和文件信息

/***GO-BACK-N協議,確認幀為捎帶確認***/

#include?
#include?
#include?“protocol.h“
#include?“datalink.h“

#define?inc(k)?if(k#define?DATA_TIMER??2800
#define?MAX_SEQ?7
#pragma?comment(lib“Protocol.lib“)

typedef?struct{?
????unsigned?char?kind;?/*?frame_DATA?*/
????unsigned?char?ack; ?//ACK?number
????unsigned?char?seq; ?//seq?bumber
????unsigned?char?data[PKT_LEN];?//凈荷域
????unsigned?int??padding;???????//存放CRC校驗和
}frame;


static?unsigned?char?frame_nr?=?0buffer[MAX_SEQ+1][PKT_LEN]?nbuffered=0;
static?unsigned?char?frame_expected?=?0ack_expected=0next_frame_to_send=0;
static?int?phl_ready?=?0;


int?between(unsigned?char?aunsigned?char?bunsigned?char?c) //判斷幀有沒有在當前窗口中
{
if(((a<=b)&&(b return?1;
else
return?0;
}



static?void?put_frame(unsigned?char?*frame?int?len)
{
????*(unsigned?int?*)(frame?+?len)?=?crc32(frame?len);
????send_frame(frame?len?+?4);
????phl_ready?=?0;
}

static?void?send_data_frame(void) //將幀傳遞給物理層傳送,并開始計時器計時
{
????frame?s;
s.kind?=?frame_DATA;
s.seq?=?next_frame_to_send;
s.ack?=?(frame_expected+MAX_SEQ)%(MAX_SEQ+1);
memcpy(s.databuffer[next_frame_to_send]PKT_LEN);
dbg_frame(“Send?DATA?%d?%d?ID?%dwindows?%d\n“?s.seq?s.ack?*(short?*)s.datanbuffered);
put_frame((unsigned?char?*)&s?3?+?PKT_LEN);
????start_timer(next_frame_to_send?DATA_TIMER);

}




int?main(int?argc?char?**argv)
{
????int?event?arg;
????frame?f;
????int?len?=?0;
int?i;
????protocol_init(argc?argv);?

評論

共有 條評論