简体   繁体   English

当我使用httpurlconnection时如何设置tcp.nodelay

[英]how to set tcp.nodelay when i use httpurlconnection

How to set tcp.nodelay for below given code: 如何为以下给定代码设置tcp.nodelay

URL url = new URL(urlText);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();

As far as I am aware you cannot set tcp.noDelay on `HttpURLConnection' as this does not allow any interface to alter underlaying tcp socket. 据我所知,您无法在“ HttpURLConnection”上设置tcp.noDelay ,因为这不允许任何接口更改底层tcp套接字。

What I can recommend is try using Apache http client as it provide mechanism to set multiple TCP options. 我建议您尝试使用Apache http客户端,因为它提供了设置多个TCP选项的机制。 Have a look at this DefaultHttpClient 看看这个DefaultHttpClient

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何为 spring 引导应用程序上的数据库连接设置 TCP NODELAY - How to set TCP NODELAY for db connections on a spring boot application TCP_NODELAY如何影响连续的write()调用? - How does TCP_NODELAY affect consecutive write() calls? 如何让HttpURLConnection使用代理? - How do I make HttpURLConnection use a proxy? 如何将 HttpURLConnection 与 RxJava 一起使用? - How do I use HttpURLConnection with RxJava? 使用HttpUrlConnection时如何从CookieManager设置cookie? - How to set cookie from CookieManager when using HttpUrlConnection? 如何使用 HttpURLConnection 在 Java 中设置下载器代理的名称? - How I set the name of my downloader agent in Java, using the HttpURLConnection? 用Java在HttpURLConnection中设置cookie的时间是什么时候? - When is the cookie set in HttpURLConnection with Java? 当我使用 HttpUrlConnection 从特定 url 下载信息时出错 - Error when I use HttpUrlConnection to download info from a specific url 服务器不可用时,应用程序崩溃。 如何设置httpurlconnection的connectiontimeout? - App crashes when the server is not available. How to set the connectiontimeout for httpurlconnection? 如何在Android上将自己的方法与HttpURLConnection对象一起使用? - How do I use my own method with an HttpURLConnection object on Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM