OkHttp - 现代应用网络的方式

官网:Overview - OkHttp

HTTP is the way modern applications network. It's how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.

OkHttp is an HTTP client that's efficient by default:

  • HTTP/2 support allows all requests to the same host to share a socket.
  • Connection pooling reduces request latency (if HTTP/2 isn't available).
  • Transparent GZIP shrinks download sizes.
  • Response caching avoids the network completely for repeat requests.

OkHttp perseveres when the network is troublesome: it will silently recover from common connection problems. If your service has multiple IP addresses, OkHttp will attempt alternate addresses if the first connect fails. This is necessary for IPv4+IPv6 and services hosted in redundant data centers. OkHttp supports modern TLS features (TLS 1.3, ALPN, certificate pinning). It can be configured to fall back for broad connectivity.

Using OkHttp is easy. Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks.

相关推荐
tan77º几秒前
【Linux网络编程】Socket - UDP
linux·服务器·网络·c++·udp
小白爱电脑25 分钟前
光纤的最小弯曲半径是多少?
网络
花落已飘2 小时前
多线程 vs 异步
linux·网络·系统架构
qq_171538854 小时前
TCP/IP协议精解:IP协议——互联网世界的邮政编码系统
网络·网络协议·tcp/ip
珹洺4 小时前
计算机网络:(七)网络层(上)网络层中重要的概念与网际协议 IP
网络·tcp/ip·计算机网络
兮动人5 小时前
获取终端外网IP地址
java·网络·网络协议·tcp/ip·获取终端外网ip地址
怦然星动_5 小时前
eNSP中实现vlan间路由通信(路由器)
网络·智能路由器
zyx没烦恼7 小时前
TCP相关实验
服务器·网络·tcp/ip
HumanRisk14 小时前
降低网络安全中的人为风险:以人为本的路径
网络·安全·web安全
island131416 小时前
节点小宝内网穿透实测:告别“无网”烦恼,让你的设备“触手可及”
网络·智能路由器