udp linux 编程_Linux UDP编程教程

udp linux 编程

UDP has its advantages over TCP, such as being relatively lightweight and receiving one packet per read call (recvmsg), although the programmers need to handle related issues, such as packet lost and out-of-order packets delivery. This post gives information and references on how to write UDP programs in a C/Linux environment.

UDP具有优于TCP的优点,例如,它相对轻便,并且每次读取调用都接收一个数据包( recvmsg ),尽管程序员需要处理相关问题,例如数据包丢失和无序的数据包传递。 这篇文章提供了有关如何在C / Linux环境中编写UDP程序的信息和参考。

什么是UDP∞ (What is UDP )

Check the wikipedia article on UDP User Datagram Protocol for a brief overview. RFC 768 defines the standard of the UDP. For an introduction to TCP and UDP, the wiki book TCP and UDP Protocols is a good source.

查看UDP 用户数据报协议上的Wikipedia文章,以获取简要概述。 RFC 768定义了UDP的标准。 对于TCP和UDP的介绍,Wiki书TCP和UDP协议是很好的资料。

在Linux / Unix上用C进行UDP 编程 (UDP Programming in C on Linux/Unix )

For beginners to UDP programming, I recommend the easy to follow tutorial UDP makde simple. This tutorial can help you quickly get started writing UDP programs.

对于UDP编程的初学者,我建议使用易于遵循的UDP makde simple 教程 。 本教程可以帮助您快速开始编写UDP程序。

For more details on UDP programming including UDP sockets and detailed explanation of the data structures used, check this tutorial: Programming with UDP sockets. This worksheet Introduction to User Datagram Protocol on *nix with C can also be a good learning material.

有关包括UDP套接字在内的UDP编程的更多详细信息以及所使用的数据结构的详细说明,请查看本教程: 使用UDP套接字进行编程 。 该工作表在带有C的* nix上的用户数据报协议简介也可以是很好的学习材料。

If you would like to study even more details, check Beej’s Guide to Network Programming.

如果您想研究更多细节,请查看Beej的《网络编程指南》

As aforementioned, UDP has its complexities for programming with. For reliable bulk data transfer, UDT is a possible good option.

如前所述,UDP具有用于编程的复杂性。 对于可靠的批量数据传输,UDT是一个不错的选择。

UDT:基于UDP的数据传输 (UDT: UDP-based Data Transfer )

UDT is an efficient and easy to use library to transfer bulk data with its own reliability control and congestion control mechanisms. Being fast is one of UDT’s key features. Besides, concurrent UDT flows can share the available bandwidth fairly and UDT is also friendly to TCP flows.

UDT是一个高效且易于使用的库,具有自己的可靠性控制和拥塞控制机制,可以传输大量数据。 快速是UDT的主要功能之一。 此外,并发的UDT流可以公平地共享可用带宽,并且UDT对TCP流也很友好。

For the design of UDT, check the paper UDT: UDP-based data transfer for high-speed wide area networks and Supporting Configurable Congestion Control in Data Transport Services. For more technical details, the Internet-Draft UDT: UDP-based Data Transfer Protocol is a good point to start with. And of course, you can read the source code of UDT which is opened under BSD license (since UDT version 4).

对于UDT的设计,请查看UDT:高速广域网的基于UDP的数据传输数据传输服务中支持可配置的拥塞控制 。 有关更多技术细节,Internet Draft UDT:基于UDP的数据传输协议是一个很好的起点。 当然,您可以阅读在BSD许可下打开的UDT的源代码(从UDT版本4开始)。

编程使用UDT (Programming Using UDT )

The UDT manuals provides easy to follow guide on installation and programming tutorial: UDT 4 documents.

UDT手册提供了易于安装和编程的指南: UDT 4文档

To check out the UDT source code from its git repository on Sourceforge:

要从Sourceforge上的git存储库中检出UDT源代码:

$ git clone git://git.code.sf.net/p/udt/git udt-git

As UDT is a C++ library, to use it in C or other languages, you need to wrap the APIs in C (for languages other that C, you may need to wrap the C functions again). Tom Zhou already provides a C wrapper implementation also under the BSD license which can be downloaded here.

由于UDT是C ++库,要在C或其他语言中使用它,则需要将API用C包装(对于C以外的语言,可能需要再次包装C函数)。 Tom Zhou已经在BSD许可下提供了C包装器实现,可以在此处下载。

Have other good suggestions on UDP programming? Share them in the comments.

关于UDP编程还有其他好的建议吗? 在评论中分享它们。

翻译自: https://www.systutorials.com/udp-programming-on-linux/

udp linux 编程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值