UDP 介绍

User
Datagram Protocol

----------------------

Introduction


This User
Datagram  Protocol  (UDP) 
is  defined  to 
make  available  a

datagram   mode 
of  packet-switched   computer  
communication  in  the

environment  of 
an  interconnected  set 
of  computer  networks.  
This

protocol  assumes 
that the Internet  Protocol  (IP) 
[1] is used as the

underlying
protocol.

This
protocol  provides  a procedure 
for application  programs  to send

messages  to other programs  with a minimum  of protocol mechanism.  The

protocol  is transaction oriented, and delivery and
duplicate protection

are not
guaranteed.  Applications requiring
ordered reliable delivery of

streams of
data should use the Transmission Control Protocol (TCP) [2].

用户数据包协议 UDP

介绍:

用户数据包协议的制定了,在一个内联的电脑网络环境中,电脑之间进行包交换时,需使用的数据包模式。这个协议的前提是IP被用作底层协议。

这个协议提供了一个程序:当应用程序向其他程序发送信息的时候,只需进行微量的协议构造。这个协议是传输向的,所以不保证传递和重发。如果应用需要可靠的数据流传递的话,应该使用TCP。

The QUdpSocket class provides a UDP socket.

UDP (User Datagram Protocol) is a
lightweight, unreliable, datagram-oriented, connectionless protocol. It can be
used when reliability isn’t important. QUdpSocket is a subclass of QAbstractSocket
that allows you to send and receive UDP datagrams.

QUdpSocket类提供了一个UDP的一组接口。

UDP是轻量的,不可靠的,数据包向的,少链接的协议。当可靠性不重要的时候可以使用。QUdpSocket是QAbstractSocket的子集,让你可以发送和接受UDP包。

The most common way to use this class is to
bind to an address and port using bind(), then call writeDatagram()
and readDatagram()
/ receiveDatagram()
to transfer data. If you want to use the standard QIODevice
functions read(),
readLine(),
write(),
etc., you must first connect the socket directly to a peer by calling connectToHost().

使用这个类的最常用的方式是用bind()来绑定地址和串口,然后调用writeDatagram()和readDatagram()/receiveDatagram()来传递数据。如果你要使用标准的QIODevice的函数read(),readLine(),write(),等等,你必须先用connectToHost()直接把这个套接字链接到一个peer。

总结:#include 可以使用UPD的套接字了。

4
用集线器(广播作用)链接起来的小型的网络叫局域网,跨了很大的物理距离时,需要使用路由器,这时的网络叫广域网,比如跨国公司这种,保证了不同区域之间通信的带宽,所以一般用光纤等,费用比较高。而通常所说的互联网,是一种公共的广域网,不保证带宽,所以费用较低。

5 socket套接字,是一组接口。在传输层的tcp和udp的上一层,直接和用户数据打交道的接口。典型的使用方式是“bind
-> read/write->close” ,linux系统认为万物皆是socket,万物皆是可以读写的文件。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值