Vert.x的TCP服务端和客户端配置

news/2024/5/17 15:50:57 标签: Vert.x, TCP, Java

Vert.x系列:
Vert.x介绍:https://blog.csdn.net/haoranhaoshi/article/details/89279096
Vert.x实战一:Vert.x通过Http发布数据:https://blog.csdn.net/haoranhaoshi/article/details/89284847
Vert.x实战二:TCP通信:https://blog.csdn.net/haoranhaoshi/article/details/89296522
Vert.x实战三:TCP客户端之间以角色通过服务端转接通信:https://mp.csdn.net/postedit/89296606
Vert.x实战四:TCP客户端之间以角色和同一角色连接顺序通过服务端转接通信:https://blog.csdn.net/haoranhaoshi/article/details/89296665
Vert.x实战五:TCP客户端之间以ID通过服务端转接通信:https://blog.csdn.net/haoranhaoshi/article/details/89296754
Vert.x实战六:TCP客户端之间以功能名通过服务端转接通信:https://blog.csdn.net/haoranhaoshi/article/details/89296841
Vert.x实战七:TCP设置超时断开:https://blog.csdn.net/haoranhaoshi/article/details/89296986
Vert.xTCP服务端和客户端配置:https://blog.csdn.net/haoranhaoshi/article/details/89297022
Vert.x的Http和TCP实战代码下载:https://download.csdn.net/download/haoranhaoshi/11114611

本篇:

NetServerOptions:
io.vertx.core.net_NetServerOptions:
https://vertx.io/docs/apidocs/io/vertx/core/net/NetServerOptions.html
空闲时间,默认为0,无空闲检测。
注:达到后断开长连接。
setIdleTimeout(int idleTimeout)
Set the idle timeout, default time unit is seconds.

空闲时间的单位,默认为秒(s)。
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Set the idle timeout unit.

启动TCP保活,默认为不保活。
注:保活检测时间间隔为2小时,无开放的设置方法。
https://www.cnblogs.com/onlysun/p/4520553.html
https://www.cnblogs.com/huanxiyun/articles/6613855.html
setTcpKeepAlive(boolean tcpKeepAlive)
Set whether TCP keep alive is enabled

禁用Nagle算法,默认为禁用。
注:包体过小时,启用Nagle算法,显著减小网络阻塞。包体大小相对于包头,包头固定部分20字节,可变部分0至40字节。
简单讲, Nagel算法的规则是:
如果发送内容大于1个MSS, 立即发送;
如果之前没有包未被确认, 立即发送;
如果之前有包未被确认, 缓存发送内容;
如果收到ack, 立即发送缓存的内容。
https://blog.csdn.net/u014532901/article/details/78573261
https://blog.csdn.net/shaobingj126/article/details/6758707
setTcpNoDelay(boolean tcpNoDelay)
Set whether TCP no delay is enabled

加强的nagle算法,默认为禁用。
注:过程和nagle算法类似,都是累计数据然后发送。但它没有 nagle中1的限制,所以,在设置cork后,即使所有ack都已经收到,但我还是不想发送数据,我还想继续等待应用层更多的数据,所以它的效果比nagle更好。效率上与Nagle算法相比,Nagle算法主要避免网络因为太多的小包(协议头的比例非常之大)而拥塞,而CORK算法则是为了提高网络的利用率,使得总体上协议头占用的比例尽可能的小。
https://www.cnblogs.com/biyeymyhjob/p/4670502.html
setTcpCork(boolean tcpCork)
Enable the TCP_CORK option - only with linux native transport.

支持服务器名称指示(Server Name Indication),默认不支持。
注:一个服务器上可以为多个域名提供服务。
https://blog.csdn.net/makenothing/article/details/53292335
setSni(boolean sni)
Set whether the server supports Server Name Indiciation

延迟关闭的时间(单位:秒),默认为-1;注:设置延迟关闭的时间,等待套接字缓冲区中的数据发送完成。
setSoLinger(int soLinger)
Set whether SO_linger keep alive is enabled

支持安全套接字层,默认不支持。
注:
SSL:(Secure Socket Layer,安全套接字层),为Netscape所研发,用以保障在Internet上数据传输之安全,利用数据加密(Encryption)技术,可确保数据在网络上之传输过程中不会被截取。当前版本为3.0。它已被广泛地用于Web浏览器与服务器之间的身份认证和加密数据传输。
SSL协议位于TCP/IP协议与各种应用层协议之间,为数据通讯提供安全支持。SSL协议可分为两层: SSL记录协议(SSL Record Protocol):它建立在可靠的传输协议(如TCP)之上,为高层协议提供数据封装、压缩、加密等基本功能的支持。 SSL握手协议(SSL Handshake Protocol):它建立在SSL记录协议之上,用于在实际的数据传输开始前,通讯双方进行身份认证、协商加密算法、交换加密密钥等。
TLS:(Transport Layer Security,传输层安全协议),用于两个应用程序之间提供保密性和数据完整性。
TLS 1.0是IETF(Internet Engineering Task Force,Internet工程任务组)制定的一种新的协议,它建立在SSL 3.0协议规范之上,是SSL 3.0的后续版本,可以理解为SSL 3.1,它是写入了 RFC 的。该协议由两层组成: TLS 记录协议(TLS Record)和 TLS 握手协议(TLS Handshake)。较低的层为 TLS 记录协议,位于某个可靠的传输协议(例如 TCP)上面。
SSL/TLS原理详解:https://segmentfault.com/a/1190000002554673?utm_source=tag-newest
Vert.x3 Core手册 [Part 2. TCP 服务器与客户端 ]:https://www.jianshu.com/p/f572654906a2
setSsl(boolean ssl)
Set whether SSL/TLS is enabled

支持TCP快速确认,默认不支持。
注:Ack(Acknowledgement),确认字符。在数据通信中,接收站发给发送站的一种传输类控制字符。表示发来的数据已确认接收无误。
setTcpQuickAck(boolean tcpQuickAck)
Enable the TCP_QUICKACK option - only with linux native transport.

setTcpFastOpen(boolean tcpFastOpen)
Enable the TCP_FASTOPEN option - only with linux native transport.

setTrafficClass(int trafficClass)
Set the value of traffic class

setTrustOptions(TrustOptions options)
Set the trust options.

setUseAlpn(boolean useAlpn)
Set the ALPN usage.

setUsePooledBuffers(boolean usePooledBuffers)
Set whether Netty pooled buffers are enabled


http://www.niftyadmin.cn/n/752603.html

相关文章

【python】【爬虫】爬取Fate Grand Order wiki所有英灵礼装图鉴

import requests from lxml import etreefor i in range(1,895): url0"https://fgowiki.com/guide/equipdetail/894?ppc" #网页地址resrequests.get(url0)contentres.contenthtmletree.HTML(content)namehtml.xpath(//*[id"row-move"]/div[2]/div/div[2…

TCP解读

TCP 三次握手 第一次: 客户端 - - > 服务端 发送目标&#xff1a;我要连你 第二次: 客户端 < - - 服务端 发送目标&#xff1a;可以 第三次: 客户端 - - > 服务端 发送目标&#xff1a;收到 TCP 详解&#xff1a;https://blog.csdn.net/sinat_36629696/article/detail…

Mysql 内置函数大全

转载并整理&#xff1a; 包括&#xff1a; 数值进制&#xff1b; 字符串长度、截取、填充、删除、拼接等&#xff1b; 文件读取&#xff1b; 数值绝对值、正负判断、取模、取整、次方、对数、开方、三角函数、反三角函数、随机数、弧度和角度、精确度保留、最大值和最小值…

【Hadoop】自定义Hadoop序列化been Demo

package hadoop.mapreduce.serializable;import org.apache.hadoop.io.Writable;import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; /* * 自定义Hadoop序列化 * */ public class MySerializable implements Writable {private String name;pr…

Mysql加解密

SELECT PASSWORD(you); # *1A11AE440F0BFE14CF065EA776CEFA20B3BCF946 SELECT MD5(you); # 639bae9ac6b3e1a84cebb7b403297b79 /* you为明文&#xff0c;key为密钥&#xff0c;ENCODE(you, key)为you经key加密后得到的密文 */ SELECT ENCODE(you, key); # l0 /* 对密文l0使用…

在Linux中CSV转换成XLSX

在linux中&#xff0c;把csv文件转换成excel表格&#xff08;xlsx或者xls&#xff09; $ echo -e surname,name,age\nCarlo,Smith,23\nJohn,Doe,46\nJane,Doe,69\nSarah,Meyer,23\n > example.csv $ unix2dos example.csv $ ssconvert example.csv example.xlsx $ ssconvert…

zookeeper安装配置

1&#xff1a;解压安装 sudo tar -zxvf /home/hadoop/ftpDocuments/zookeeper-3.4.10.tar.gz -C /usr/local/ sudo mv zookeeper-3.4.10 zookeeper chown -R hadoop zookeeper/ 2&#xff1a;修改zookeeper/conf目录下配置文件zoo_sample.cfg sudo mv zoo_sample.cfg zoo.cf…

Dubbo和Zookeeper

总结&#xff1a;Dubbo负责服务管理&#xff0c;其中的服务注册可以交给Zookeeper。服务注册&#xff0c;即确定什么节点有什么服务。 dubbo支持多种类型的注册中心&#xff1a; Multicast注册中心 Zookeeper注册中心 Redis注册中心 Simple注册中心 从头开始搭建一个dubbozooke…