• UDR rsync


    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.

  • 相关阅读:
    为lvm逻辑分区扩容
    Linux性能优化课程笔记-CPU性能工具
    Linux性能优化课程笔记-bcc工具
    nmcli命令添加bond网口
    IPv6地址冲突
    mongodb的审计功能
    BIND支静态存根区域
    git的使用(2)
    全世界都在学python-打开文件
    java操作mongodb时,对象bean和DBObject相互转换的方法
  • 原文地址:https://www.cnblogs.com/rsapaper/p/10197615.html
Copyright © 2020-2023  润新知