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. CentOS 6.4 命令行 安装 VMware Tools

    新建cdrom挂载目录 mkdir /mnt/cdrom 挂载光驱 mount -t auto /dev/cdrom /mnt/cdrom这命令就是把CentOS CDROM挂载在/mnt/cdrom ...

  2. Android图片的合成示例

    package com.example.demo; import android.os.Bundle; import android.app.Activity; import android.grap ...

  3. wordpress for sae

    帮人建个站,准备用sae+wordpess,小研究一下 http://sae.sina.com.cn/?m=apps&a=detail&aid=1 http://wp4sae.org/ ...

  4. Python查找文件

    1. 利用字符串的前缀和后缀匹配查找文件 str.startswith() star.endswith() 2.使用fnmatch fnmatch              判断文件名是否符合特定模式 ...

  5. mybatis 之引入多个model

    配置hessian: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configurati ...

  6. code_blocks 使用操作手册

                                                                              38 39 编译以上程序,产生如下提示信息. 如此简 ...

  7. N76E003的学习之路(一)

    N76E003是8051内核的一款单片机MCU,它提供丰富的特殊功能模块,包括: 1KRAM其中包括256字节SRAM,768字节XRAM. 最多可达18个标准管脚. 两组标准16位定时器/计数器:定 ...

  8. IDEA试用期结束激活问题

    1.试用期结束,出现IDEA License Activation界面 2.IntelliJ Idea 2017 免费激活方法 方法1. 到网站 http://idea.lanyus.com/ 获取注 ...

  9. 【Python3】 使用django 2.0 + python3.6.4 创建应用

    python版本:3.6.4 django版本:2.0 1 创建应用 输入命令 python manage.py startapp blog 2 在项目目录创建 templates文件夹 用于存放我们 ...

  10. 使用Maven命令安装jar包到仓库中

    项目中可能会碰到很多jar包,使用maven update不能更新,或者jar包是拷贝过来,不能编译的情况.此时就需要手动使用命令行安装. 例如Demo项目中提示缺少四个jar包,但是在repo中已经 ...