1、

SOCK_DGRAM  UDP packets

SOCK_STREAM   TCP

不同的协议下的 套接字 数据包

面向数据的

面向连接的

套接字

2、

数据 UDP

文件 TCP

https://www.quora.com/Whats-the-difference-between-SOCK_RAW-and-SOCK_STREAM

Basically SOCK_DGRAM is used for UDP packets, SOCK_STREAM for TCP. As far as reliability issues, it's UDP vs. TCP issues - no guarantee for UDP, guaranteed delivery for TCP.

SOCK_STREAM for data streaming and SOCK_DGRAM for messaging. Note that UDT sockets are connection oriented in all cases.

https://github.com/LabAdvComp/UDR/blob/49ca8b5ab63b46c835c6d90ffc5ab4f1bf26ea0c/udt/doc/doc/socket.htm

https://github.com/LabAdvComp/UDR/blob/49ca8b5ab63b46c835c6d90ffc5ab4f1bf26ea0c/udt/src/core.h

static UDTSOCKET socket(int af, int type = SOCK_STREAM, int protocol = 0);

https://github.com/LabAdvComp/UDR/blob/49ca8b5ab63b46c835c6d90ffc5ab4f1bf26ea0c/udt/src/core.cpp

if ((UDT_STREAM == m_iSockType) && (m_pRcvBuffer->getRcvDataSize() > 0))
s_UDTUnited.m_EPoll.enable_read(m_SocketID, m_sPollID);
else if ((UDT_DGRAM == m_iSockType) && (m_pRcvBuffer->getRcvMsgNum() > 0))
s_UDTUnited.m_EPoll.enable_read(m_SocketID, m_sPollID);

https://stackoverflow.com/questions/5815675/what-is-sock-dgram-and-sock-stream

TCP almost always uses SOCK_STREAM and UDP uses SOCK_DGRAM.

TCP/SOCK_STREAM is a connection-based protocol. The connection is established and the two parties have a conversation until the connection is terminated by one of the parties or by a network error.

UDP/SOCK_DGRAM is a datagram-based protocol. You send one datagram and get one reply and then the connection terminates.

  • If you send multiple packets, TCP promises to deliver them in order. UDP does not, so the receiver needs to check them, if the order matters.

  • If a TCP packet is lost, the sender can tell. Not so for UDP.

  • UDP datagrams are limited in size, from memory I think it is 512 bytes. TCP can send much bigger lumps than that.

  • TCP is a bit more robust and makes more checks. UDP is a shade lighter weight (less computer and network stress).

Choose the protocol appropriate for how you want to interact with the other computer.

UDR rsync的更多相关文章

  1. rsync 笔记之 list

    通过 rsync --list-only 可以列出可用的 文件/目录或者 module 下面两者的含义是完全不同的: rsync --list-only root@192.168.4.140: 使用系 ...

  2. 配置rsync服务,数据同步。

    这部分设计服务器端和客户端. [服务器端] 如果服务器没有安装rsync服务则使用yum安装rsync服务. yum install rsync 然后 vim /etc/xinetd.d/rsync ...

  3. 使用rsync同步目录

    本文描述了linux下使用rsync单向同步两个机器目录的问题. 使用rsync同步后可以保持目录的一致性(含删除操作). 数据同步方式 从主机拉数据 备机上启动的流程 同步命令: rsync -av ...

  4. linux rsync配置文件参数详解

    一.全局参数 在[moudle]之前的参数都是全局参数,也可以在全局参数下定义部分模块参数,这时该参数的值就是所有模块的默认值. port:指定后台程序使用的端口号,默认是873 logfile:指定 ...

  5. inotify+rsync实现实时同步部署

    1.1.架构规划 1.1.1架构规划准备 服务器系统 角色 IP Centos6.7 x86_64 NFS服务器端(NFS-server-inotify-tools) 192.168.1.14 Cen ...

  6. rsync同步架构

    1.1 rsync服务器端配置 1.1.1 查看服务器端rsync版本 1.1.2 创建配置文件 默认安装好rsync程序后,并不会自动创建rsync的主配置文件,需要手工来创建,其主配置文件为“/e ...

  7. rsync同步

    本地同步: rsync -avz /boot /test C/S架构: 远程同步:rsync+ssh 远程浏览器目录文件:rsync  用户@192.168.0.250:/boot 下行:rsync ...

  8. 使用rsync+inotify同步两台服务器文件

    目标功能:将B服务器文件同步到A服务器 A服务器rsyncd.conf配置 权限600 A服务器rsyncd.pas文件配置  权限600 同步文件路径 /data/wwwroot/shen/  权限 ...

  9. 通过rsync+inotify实现数据的实时备份

    我讲到过利用rsync实现数据的镜像和备份,但是要实现数据的实时备份,单独靠rsync还不能实现,本文就讲述下如何实现数据的实时备份. 一.rsync的优点与不足 与传统的cp.tar备份方式相比,r ...

随机推荐

  1. 让树莓派自动上报IP地址到邮箱,二代B

    由于我使用树莓派的场景大多数是在没有显示器.只用terminal连接它的情况下,所以,它的IP地址有时会在重启之后变掉(DHCP的),导致我无法通过terminal连接上它.然后我又要很麻烦地登录路由 ...

  2. http 返回码 405 解决方案之一

    今天做网络请求数据的时候遇到返回码405,当时就傻了~~ 故事是这样的-- 我用post请求访问一个url,服务端数据是一个json的txt文件,理论上直接访问,返回json,然后解析就没事了,可是今 ...

  3. Splash images_enabled 属性

    images_enabled属性用于设置加载页面时是否加载图片,如下,禁止之后,返回的页面截图就不会带有任何图片,加载速度也会快很多 function main(splash, args) splas ...

  4. [Ubuntu] arp-scan - 扫描网络设备

    使用arp-scan扫描所有网络设备信息. 1. 安装arp-scan ifantastic@ubuntu:~$ sudo apt-get install arp-scan 2. 扫描网络所有设备 i ...

  5. codeforces水题100道 第二十题 Codeforces Round #191 (Div. 2) A. Flipping Game (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/327/A题意:你现在有n张牌,这些派一面是0,另一面是1.编号从1到n,你需要翻转[i,j]区间的 ...

  6. Java EE发展史

    前言 最近的这段时间一直在学习Java EE,刚刚完成了从0到1的蜕变,所以顺便整理一下我所了解到的Java EE,给刚入门学习的新人一些头绪,而所谓“启示录”,就是这个意思. 一.Java EE是什 ...

  7. liunx trac 邮件提示功能

    http://trac.edgewall.org/wiki/TracNotification官网上提供的方法.个人觉得不是清楚,不过还是有参考价值的.以下写下自己的添加过程,以作记录. 1.the [ ...

  8. -webkit-transition -moz-transition transition

    -webkit-transition  -moz-transition transition 可以定义动画的变化时间曲线-webkit-transition-timing-function: ease ...

  9. Android 手机震动

    1.添加震动权限 <uses-permission android:name="android.permission.VIBRATE"/> 2.获取震动服务 Vibra ...

  10. What you should know about .so files

    In its early days, the Android OS was pretty much supporting only one CPU architecture: ARMv5.Do you ...