freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

三種arq協(xié)議的c語言算法(已修改)

2025-06-12 01:52 本頁面
 

【正文】 三種ARQ協(xié)議的C語言算法一、 停止等待ARQ (stopandwait ARQ)/* Protocol 2 (stopandwait) also provides for a onedirectional flow of data from sender to receiver. The munication channel is once again assumed to be error free, as in protocol 1. However, this time, the receiver has only a finite buffer capacity and a finite procesing speed, so the protocol must explicitly prevent the sender from flooding the receiver with data faster than it can be handled. */typedef enum {frame_arrival} event_type。include void sender2(void){ frame s。 /* buffer for an outbound frame */ packet buffer。 /* buffer for an outbound packet */ event_type event。 /* frame_arrival is the only possibility */ while (true) { from_network_layer(amp。buffer)。 /* go get something to send */ = buffer。 /* copy it into s for transmission */ to_physical_layer(amp。s)。 /* bye bye little frame */ wait_for_event(amp。event)。 /* do not proceed until given the go ahead */ }}void receiver2(void){ frame r, s。 /* buffers for frames */ event_type event。 /* frame_arrival is the only possibility */ while (true) { wait_for_event(amp。event)。 /* only possibility is frame_arrival */ from_physical_layer(amp。r)。 /* go get the inbound frame */ to_network_layer(amp。)。 /* pass the data to the network layer */ to_physical_layer(amp。s)。 /* send a dummy frame to awaken sender */ }} 二、 回退N幀ARQ(gobackn ARQ)/* Protocol 5 (pipelining) allows multiple outstanding frames. The sender may transmit up to MAX_SEQ frames without waiting for an ack. In addition, unlike the previous protocols, the network layer is not assumed to have a new packet all the time. Instead, the network layer causes a network_layer_ready event when there is a packet to send. */define MAX_SEQ 7 /* should be 2^n 1 */typedef enum {frame_arrival, cksum_err, timeout, network_layer_ready} event_type。include static boolean between(seq_nr a, seq_nr b, seq_nr c){/* Return true if (a =b c circularly。 false otherwise. */ if (((a = b) amp。amp。 (b c)) || ((c a) amp。amp。 (a = b)) || ((b c) amp。amp。 (c a))) return(true)。 else return(false)。}static void send_data(seq_nr frame_nr, seq_nr frame_expected, packet buffer[]){/* Construct and send a data frame. */ frame s。 /* scratch variable */ = buffer[frame_nr]。 /* insert packet into frame */ = frame_nr。 /* insert sequence number into frame */ = (frame_expected + MAX_SEQ) % (MAX_SEQ + 1)。 /* piggyback ack */ to_physical_layer(amp。s)。 /* t
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號-1