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. 安装centos6.5

    我是在虚拟机上面安装的centos6.5,本机的系统是windows 2008 datacenter. 到这个地方下载镜像文件:http://mirrors.sohu.com/centos/6.5/i ...

  2. Python中的yield和Generators(生成器)

    本文目的 解释yield关键字到底是什么,为什么它是有用的,以及如何来使用它. 协程与子例程 我们调用一个普通的Python函数时,一般是从函数的第一行代码开始执行,结束于return语句.异常或者函 ...

  3. CM和CDH的安装-准备工作

    估计要分开来两篇博客说明,因为截图较多. 1.三个节点cdh1(主节点),cdh2,cdh3 配置就用一张图来说明,因为资源有限 2.版本依赖说明: CDH-5.9.0-1.cdh5.9.0.p0.2 ...

  4. SpringBoot(十三)-- 不同环境下读取不同配置

    一.场景: 在开发过程中 会使用 开发的一套数据库,测试的时候 又会使用测试的数据库,生产环境中 又会切换到生产环境中.常用的方式是 注释掉一些配置,然后释放一下配置.SpringBoot提供了在不同 ...

  5. radio的取值

    <dd id="pingjia${evaluation.orderItemId }" class="ms-wf clearfix" idx="$ ...

  6. INSTALL_FAILED_USER_RESTRICTED

    我这里出问的问题是在 清单文件中 <provider <mate_data 中少了   android:resource="@xml/filepaths" 加上就好 了

  7. JTAG、JLink、ULINK、ST-LINK仿真器区别(转)

    首先要了解一下JTAG. JTAG协议 JTAG(Joint Test Action Group,联合测试行动小组)是一种国际标准测试协议(IEEE 1149.1兼容),主要用于芯片内部测试.现在多数 ...

  8. sql server性能查询,连接数

    1)使用以下查询语句:   select * from sysprocesses where dbid in (select dbid from sysdatabases where name='My ...

  9. android基础---->WidGet的使用

    Widget是一个可以添加在别的应用程序中的”小部件”,我们可以使用自定义的Widget远程控制我们的程序做一些事情.一般用于在桌面上添加一个小部件,现在我们开始小部件的学习. 目录导航: WidGe ...

  10. 七、K3 WISE 开发插件《Update字段级更新触发器 - BOS单审核后反写源单》

    审核成功触发,是一个比较典型的场景.需要用到update触发器,跟踪到审核状态的变化. 引用的源码<采购检验单审核后反写收料通知单>,其中采购检验单是BOS自定义单据. if (objec ...