1. 程式人生 > >一個基於UDP的可靠資料傳輸庫

一個基於UDP的可靠資料傳輸庫

A UDP-based Reliable Data Transfer Library

一個基於UDP的可靠資料傳輸庫

Introduces an open source UDP-based data transfer library.

介紹了一個開源的基於UDP的輸出傳輸庫。

Introduction

簡介

This article introduces an open source UDP-based data transfer library, namely UDT (UDP-based Data Transfer).

本文章介紹了一個開源的基於UDP的資料傳輸庫,即UDT(基於UDP的資料傳輸)。

Currently, there are two major Internet transport protocols, TCP and UDP. TCP provides connection oriented reliable data streaming service, whereas UDP provides connection-less unreliable messaging service. Most applications use TCP to transfer data because they require data reliability.

目前,有兩個主要的網路傳輸協議,TCP

UDPTCP提供面向連線的可靠資料流服務,而UDP提供無連線的不可靠訊息服務。大部分應用程式使用TCP傳輸資料,因為它們需要資料的可靠性。

However, when using TCP some applications suffer from two problems. First, TCP demonstrates poor performance in long distance links, especially when the bandwidth is high (e.g., 1GB/s or higher). Second, when incorporating multiple concurrent TCP flows with different RTTs in the same application, different TCP flows may have different data transfer rates (also known as RTT bias).

然而,當使用TCP時,一些應用程式苦於如下兩個問題。首先,TCP在遠端連線方面顯示出效能不佳,尤其當頻寬相當高時(例如,1GbB/s或者更高)。其次,當在一個應用程式中包含多個併發的TCP流具有不同的RTTs時,不同的TCP流可能具有不同的資料傳輸速率(也稱謂RTT偏差)。

There are other situations where people do not want to use either TCP or UDP. For example, an application may require data reliability (so cannot use UDP directly) but also wants data to arrive at a user-controlled rate or the message boundaries to be conserved. Furthermore, sometimes it is easier to use UDP to traverse firewalls than TCP.

在其它情況下,人們既不希望使用TCP,也不希望使用UDP。例如,一個應用程式可能需要資料的可靠性(所以不能直接使用UDP),但是也想要資料以一個使用者控制速率到達,或者訊息邊界是保守的。此外,與TCP比起來,使用UDP更容易穿越防火牆。

It may be helpful to build an open source user space transport protocol above UDP, but with the data reliability control and network flow/congestion control. Because it is at user space, it is easy to get installed. Because it is open source, it can be easily modified to meet various requirements from applications.

它可以幫助在UDP之上建立一個開源的使用者空間傳輸協議,但是具有資料可靠性控制和網路流量/擁塞控制。因為它是在使用者空間,它很容易進行安裝。因為它是開源的,它可以方便地進行修改,以滿足各種應用的要求。

Example applications

應用示例

Here we present two example applications in which you may need UDT.

在這裡,我們提出了兩個示例應用程式,在它們中您可能需要UDT

a. Bulk data transfer and online streaming data processing 大容量資料傳輸和線上式流媒體資料處理

Suppose a company has their data stored in multiple branches around the world, each branch having its own part of the dataset. The datasets are very large (terabytes) and the company has a 1GB/s intranet to deliver them. Now one of its departments at Chicago branch wants to analyze its own dataset and the dataset of the London branch. This data analysis application will need to read two datasets (at London and Chicago, respectively) using the company's 1GB/s intranet to a computer at Chicago.

假設一個公司將自己的資料儲存在世界各地的多個分支,每個分支都有自己的資料集的一部分。該資料集非常大(TB),並且公司具有1GB/s的企業內部網去傳遞它們。現在,它的一個在芝加哥的分公司的部門想要分析它自己的資料集,以及倫敦分公司的資料集。該資料分析應用程式將需要通過使用該公司的1GB/s的企業內部網讀取兩個資料集(分別在倫敦及芝加哥)到芝加哥的一臺電腦上。

Recall the two problems of TCP mentioned above. First, the link must be extremely clean (very little packet loss) for TCP to fully utilize the 1GB/s bandwidth between London and Chicago. Second, when the two TCP streams (London->Chicago, Chicago->Chicago) start at the same time, the London-Chicago stream will be starved due to the RTT bias problem, thus the data analysis process will have to wait for the slower data stream.

記得上面提到的TCP的兩個問題。首先,該連結必須非常的乾淨(很小的資料包丟失),以便於TCP充分利用該位於倫敦與芝加哥之間的1GB/s的頻寬。其次,當兩個TCP流(倫敦->芝加哥,芝加哥->芝加哥)同時開始,由於RTT問題,倫敦-芝加哥的流將處於飢餓狀態,因此,資料分析過程將不得不等待慢速資料流。

b. Application awareness 應用認知

A streaming video server is sending data to many clients. The server may choose a specific sending rate for each client during any specific period. You may have trouble asking TCP to send data at a fixed rate. And using UDP you have to do most of the data reliability control work by yourself. In addition, video frames are time sensitive data, if the frame is delayed too long, it will not be needed any more. That is, complete data reliability is not desired in this situation.

一個流式視訊伺服器向許多客戶端傳送資料。在任何特定時期,伺服器可能為每位客戶選擇一個特定的傳送速率。你可能困擾於請求TCP在一個固定的速率傳送資料。並且,使用UDP時,您不得不自行實現大部分的資料可靠性控制工作。此外,視訊幀是時間敏感的資料,如果幀延遲的時間過長,它將不再被需要。也就是說,在這種情況下,不需要完整的資料可靠性。

Using the UDT library, the programming work is simply several lines of option setting code.

當使用UDT庫時,所有的程式設計工作僅僅是幾行簡單的選項設定程式碼。

UDT

UDT is a transport protocol with its own reliability control and flow/congestion control built above UDP. UDT provides both reliable data streaming service quite similar to TCP and partial reliable messaging. The latter allows users to send data as messages with specified delivery order and time-to-live value.

UDT是一個傳輸協議,具有它自己的可靠性控制及流量/擁塞控制,建立於UDP之上。UDT同時提供了可靠的資料流服務(十分類似於TCP)與部分可靠的訊息服務。後者允許使用者將資料作為訊息進行傳送,具有特定的傳輸順序與存留時間值。

The position of UDT in the layered architecture of internet reference model is shown in the figure below. Applications use UDT socket to transfer their data, which is passed to the UDP socket. (Effort was made to avoid one time memory copy here.) A congestion control (CC) algorithm can be provided by applications; otherwise the default control algorithm is used. If user-defined control algorithm is provided, UDT will call the callback functions in CC once a control event occurs:

UDT在網際網路參考模型的分層體系結構中的位置如下圖所示。應用程式使用UDT套接字傳輸它們的資料,它們被傳遞給UDP套接字。(在這裡已經盡力避免了一次記憶體複製情況的存在)。應用程式可以提供擁塞控制(CC)演算法;否則,將使用預設的控制演算法。如果提供了使用者自定義的控制演算法,一旦傳送控制事件,UDT將在擁塞控制演算法中呼叫回撥函式:

 

The default UDT control algorithm is designed for high performance data transfer over wide area high speed networks (e.g. in the case of example a). However, UDT's congestion control algorithm is configurable such that you can add your own control algorithm with ease (e.g., in the case of example b).

預設的UDT控制演算法是專為通過高速廣域網路進行高效能資料傳輸的(例如,在示例a的情況下)。然而,UDT的擁塞控制演算法是可配置的,在這種情況下,你可以輕鬆地新增您自己的控制演算法(例如,在示例b的情況下)。

UDT provides a set of socket-like API. Using UDT in your application is simple as long as you are familiar with BSD socket. For example: With BSD socket, you write:

UDT提供了一組類似套接字的API。在你的應用程式中,使用UDT是很簡單的,只要您熟悉BSD套接字。例如,使用BSD套接字時,你編碼為:

Hide   Copy Code

int s = socket(AF_INET, SOCK_STREAM, 0);

Its counterpart in UDT is:

UDT上,對應的是:

UDTSOCKET u = UDT::socket(AF_INET, SOCK_STREAM, 0);

UDT is currently implemented using C++ and it supports Linux, Windows (2000, XP and above), and OS X. The current version is 3.0 Beta. After you download UDT, please read the "readme" file or the documentation for detailed installation and usage information. Note that if you are using Windows, you will need VC7 to get it compiled. With VC6, you will have to fix several incompatible C++ grammar by yourself.

UDT目前使用C++進行實現,並且,它支援LinuxWindows2000XP及以上),以及OS X。當前版本是3.0 Beta。在您下載UDT之後,請仔細閱讀readme檔案或文件,以獲取詳細的安裝及使用資訊。請注意,如果您使用的是Windows,您需要VC7才能編譯。使用VC6時,您必須自己去解決一些C++語法的不相容問題。

If you are interested in the project, please refer to this site for more information.

如果你對我們的專案感興趣,請參閱本網站以獲取更多的資訊。

License

授權

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

本文沒有任何明確的授權附加到它上面,但可能包含文章文字或者下載檔案本身的使用條款。如有任何疑問,請通過下面的討論板聯絡作者。

譯自

譯者

百惱

[email protected]

相關推薦

一個基於UDP可靠資料傳輸

A UDP-based Reliable Data Transfer Library 一個基於UDP的可靠資料傳輸庫 Introduces an open source UDP-based data transfer library. 介紹了一個開源的基於UDP的輸出傳輸

分組重傳機制---可靠資料傳輸原理。

不知道從哪天開始,一禪也陷入了程式設計這條道路..... 小白:你知道嗎?資料在傳輸的時候是分割成一小塊一小塊傳輸的,我們把這一小塊的資料稱之為一個分組。我們在傳輸這塊分組的時候,主要面臨兩個問題。 1、這個分組在傳輸的過程中,由於在通道傳輸過程中,收到干擾,導致這個分組到達目的地之後出現了差

學習筆記:QT+opencv:基於UDP的視訊傳輸

1 將圖片轉為QByteArray傳輸 QBuffer buffer; buffer.open(QIODevice::ReadWrite); //pixmap不能為空,必須先將圖片載入到pixmap中 pixmap.save(&buffer,"jpg"); QBy

計算機網路實驗-可靠資料傳輸協議-GBN協議的設計與實現

這一週做了一個計算機網路的實驗,名字叫 可靠資料傳輸協議-GBN協議的設計與實現 感覺自己做的很認真,實現的效果也不錯,就把自己的過程與結果記錄一下 對於這個實驗,實驗要求上說實現SR協議是加分項,而SR協議又是以GBN協議為基礎,所以自己直接一步到位,只實

如何開發一個基於 Vue 的 ui 元件(一)

開發模式 預覽 demo 在開發一個 ui 元件庫時,肯定需要一邊預覽 demo,一邊修改程式碼。 常見的解決方案是像開發一般專案一樣使用 webpack-dev-server 預覽元件,比如通過 vue-cli 初始化專案,或者自己配置指令碼。 文藝一點兒地可能會用到 parcel 來簡化 demo

計算機網路(5)-傳輸層--TCP傳輸可靠資料傳輸、流量控制、3次握手過程

TCP傳輸 TCP連線提供的服務是全雙工服務,同一連線能夠雙向傳輸資料,同時,也是點對點的連線(僅有一個傳送方和一個接收方)。 TCP報文段結構 TCP報文段由首部欄位和資料欄位組成。 首部欄位 源埠號和目的埠號:用於多路分用和多路複用 因特網檢驗和:差

TCP可靠資料傳輸是如何實現的,OSPF的工作原理

TCP可靠資料傳輸是如何實現的: 1.應用層向傳輸層傳送資料流 2.TCP把資料流分成適當長度的報文段 3.TCP為了保證不丟包以及按序接受,給每個位元組一個序號 4.TCP把結果報包給網路層 5.接收端對於成功的接收會返回確認 6.如果在對應的時間內未被確認,重傳 OS

計算機網路-可靠資料傳輸機制及其用途總結

機制 用途和說明 檢驗和 用於監測在一個傳輸分組中的位元錯誤 定時器 用於超時/重傳一個分組,可能因為該分組(或其ACK)在通道中丟失了.由於當一個分組延時但未丟

計算機網路- 可靠資料傳輸協議-停等協議的設計與實現

一、所實現停等協議簡介 我設計的程式實現的是rdt3.0版本的停等協議,傳送端將資料包以0、1交替的順序傳送資料包,當傳送0資料包之後開始計時,只有接收到ack0才能繼續傳送1資料包,如果在沒有接收到ack0的時候已經超時,這時候需要重傳資料包0; 接收方按照所收到的資料包

2017-02-11 構造可靠資料傳輸協議、滑動視窗協議、位元交替協議、回退N步協議、選擇重傳協議

2017-02-11構造可靠資料傳輸協議、滑動視窗協議、位元交替協議、回退N步協議、選擇重傳協議 1:冗餘資料分組(duplicate data packet)、2:倒計數定時器(countdown timer)、3:位元交替協議(alternating-bit pr

可靠資料傳輸原理

1 可靠資料傳輸概述 什麼是可靠? 不錯、不丟、不亂 可靠資料傳輸協議 可靠資料傳輸對應用層、傳輸層、鏈路層都很重要 網路Top-10問題 通道的不可靠特性決定了可靠資料傳輸協議(rdt)的複雜性 可靠資料傳輸協議基本結構:介面

FPGA+DSP SRIO通訊(三)——基於LSU的資料傳輸

之前的配置中我們知道如何配置通道速率、設定deviceID。 也就是馬路已經鋪設好了,我們應該造車了。 搏一搏,單車變摩托! SRIO不是單車,而是摩托車,我們需要搏一搏,把這個摩托車造出來,在我們已經鋪設好的高速路上飛馳。 目錄 下面提及的

一個基於運氣的資料結構,你猜是啥?

排行榜 懂行的老哥一看這個小標題,就知道我要以排行榜作為切入點,去講 Redis 的 zset 了。 是的,經典面試題,請實現一個排行榜,大部分情況下就是在考驗你知不知道 Redis 的 zset 結構,和其對應的操作。 當然了,排行榜我們也可以基於其他的解決方案。比如 mysql。 我曾經就基於 mys

ude協議—基於udp的全雙工可靠傳輸協議

    ude是一款基於udp的可靠傳輸協議,專門用於在資料傳輸方面對實時性要求較高的應用領域。     tcp協議雖然能保證資料的可靠傳輸,但它有以下幾個缺點:1.tcp的資料確認機制會導致傳送方重複傳送一些已經被對方接收的資料,降低了頻寬的有效利用率;2.tcp協議的超時重傳機制嚴格遵守rtt公平性,即到

RTSP請求詳解及RTP 基於UDP和TCP協議傳輸資料的對比

最近一段時間一直在研究rtsp和rtp,現在寫部落格總結一下,也是對知識的一種鞏固吧。 下面是我用VLC播放器獲取海康NVR視訊的截圖(此次獲取是基於TCP的): 下面來看一下針對每一條訊息的詳細截圖: 客戶端傳送的OPTION訊息: 伺服器對OPTION回覆的200

UDT:基於UDP可靠傳輸協議

 基於UDP 上的UDT ,比TCP傳輸效率高 UDT:基於UDP的資料傳輸協議(初譯) (譯者:Jack) Status of this Memo Internet-Drafts are working documents of th

一個基於JRTPLIB的輕量級RTSP客戶端(myRTSPClient)——實現篇:(六)RTP音視頻傳輸解析層之音視頻數據傳輸格式

客戶端 會有 服務 client 基本 cnblogs 存在 額外 導致 一、差異 本地音視頻數據格式和用來傳輸的音視頻數據格式存在些許差異,由於音視頻數據流到達客戶端時,需要考慮數據流的數據邊界、分包、組包順序等問題,所以傳輸中的音視頻數據往往會多一些字節。 舉個例子

Axios 是一個基於 promise 的 HTTP

else eve stringify http UNC bracket mil validate white NPM地址:https://www.npmjs.com/package/axios安裝使用 npm:$ npm install axios使用 bower:$ bo

一個基於ASP.NET(C#)的ACCESS數據操作類

region array conn 數據庫操作類 ide try esc [] int using System; using System.Collections; using System.Collections.Specialized; using Syst