问题标签 [protocolexception]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
409 浏览

php - Android改造多部分请求ProtocolException

我想发布一个对 SlimApi 端点进行改造的帖子。但是每次我提出请求时,我都会得到:

我的界面是这样的

我发布的 RequestBodys 是这些:

apiKey 是一个简单的字符串。所有路径均有效且经过双重检查。现在,当我开始一个请求时,我得到以下 StackTrace:

当我使用手动 REST 客户端时,服务器端 PHP 运行良好。我尝试了很多解决方案,但我不知道如何让它工作。

0 投票
2 回答
3095 浏览

java - java.net.ProtocolException:意外的状态行:

我是 Java 和 Android 编程的新手,我试图在我的服务器上获取 PHP 文件的结果,但出现以下异常:

这是异常来自的代码(在LoginActivity.java中):

导致异常的行是第#49行:

PHP 文件现在只是一个测试文件,应该返回<input_username> - <input_password>data查询字符串中的变量检索到的结果:

这个问题阻止了我大约两天,我该怎么做才能解决这个问题?

0 投票
0 回答
389 浏览

android - okhttpUtils 将音频作为参数发布但抛出 java.net.ProtocolException: expected 1875 bytes but received 2067

这是我将音频作为参数发布到我的服务器的代码,但有时它会失败,我不知道哪里错了,谁可以帮助我或给我一些建议,谢谢你~

11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: java.net.ProtocolException: 预期 1875 字节但收到 2067 11-04 15:14:03.250 21739-21739/com.smartstudy .smartmark W/System.err: 在 okhttp3.internal.http.Http1xStream$FixedLengthSink.write(Http1xStream.java:279) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okio.RealBufferedSink.flush(RealBufferedSink.java:216) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.ForwardingSink.flush(ForwardingSink.java:39) 11 -04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.250 21739-21739/com.smartstudy .smartmark W/System.err:在 com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:47) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal .connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java :92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14: 03.250 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.java:92) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.250 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.250 21739-21739/com .smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RetryAndFollowUpInterceptor。拦截(RetryAndFollowUpInterceptor.java:124)11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)11- 04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.255 21739-21739/ com.smartstudy.smartmark W/System.err:在 com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System .err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http。 RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03。255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:170) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System。错误:在 okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall$AsyncCall.execute(RealCall. java:120) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W /System.err:在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03。255 21739-21739/com.smartstudy.smartmark W/System.err:在 java.lang.Thread.run(Thread.java:841) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/ System.err:java.net.ProtocolException:预期 1875 字节,但收到 2067 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.Http1xStream$FixedLengthSink。写(Http1xStream.java:279)11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 okio.RealBufferedSink.flush(RealBufferedSink.java:216)11-04 15:14 :03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okio.ForwardingSink.flush(ForwardingSink.java:39) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System .err: 在 okio.RealBufferedSink.flush(RealBufferedSink.java:218) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err:在 com.lzy.okhttputils.request.ProgressRequestBody.writeTo(ProgressRequestBody.java:61) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.CallServerInterceptor .intercept(CallServerInterceptor.java:47) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11 -04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45) 11-04 15:14:03.255 21739-21739 /com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.255 21739-21739/com.smartstudy.smartmark W/System。错误:在 okhttp3.internal.http.RealInterceptorChain。继续(RealInterceptorChain.java:67)11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:109)11- 04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/ com.smartstudy.smartmark W/System.err: at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err :在 okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain。继续(RealInterceptorChain.java:92)11-04 15:14:03.260 21739-21739/com。smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:124) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed( RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 com.lzy.okhttputils.interceptor.LoggerInterceptor.intercept(LoggerInterceptor.java:40) 11- 04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92) 11-04 15:14:03.260 21739-21739/ com.smartstudy.smartmark W/System.err:在 okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java :170) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 okhttp3.RealCall.access$100(RealCall.java:33) 11-04 15:14:03.260 21739- 21739/com.smartstudy.smartmark W/System.err:在 okhttp3.RealCall$AsyncCall.execute(RealCall.java:120) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err : 在 okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 java.util.concurrent.ThreadPoolExecutor.runWorker( ThreadPoolExecutor.java:1112) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err:在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 11-04 15:14:03.260 21739-21739/com.smartstudy.smartmark W/System.err: 在 java.lang.Thread.run (Thread.java:841) 11-04 15:14:11.930 21739-21739/com.smartstudy.smartmark D/dalvikvm: GC_FOR_ALLOC 释放 4955K,36% 释放 42107K/65148K,暂停 56ms,总共 56ms

0 投票
1 回答
5414 浏览

android - Android MediaPlayer : info/warning (703, 0),info/warning (702, 0),info/warning (701, 0),尝试从随机位置寻找时出现ProtocolException

我使用媒体播放器从 url 流式传输 mp3 音频,现在我可以播放音乐,但是当我在随机位置选择 seekbar 时,音乐停止并且出现以下异常和警告

. 谁能帮我解决我的问题。谢谢你。

我的代码是:

Logcat 显示:

0 投票
1 回答
648 浏览

android - Volley 报 Protocol Exception 错误,21 太多后续

这是我调用的函数:

使用以下参数:

我尝试了网址:https ://control.facetalk.nl/vidyologs/call_start.php?meetingID=82000005715&profielID=51108581并且它有效,我在邮递员上得到“200”。但是 Volley 会返回以下错误:

我能做些什么来解决这个问题?我不明白,我尝试修改 detaulf 重试策略,但没有任何帮助

0 投票
1 回答
2984 浏览

java - 读取输入后无法写入输出;遇到这种情况但不确定原因

我遇到了这个问题,但不确定是否准确。

Cannot write output after reading input在日志中发现,根据上述内容,我相信这是因为 agetResponseCode()后面跟着 a getOutputStream()

这会是我看到的记录错误的原因吗?

0 投票
1 回答
49 浏览

java - 我必须从服务器获取响应代码吗?

我有以下代码

如果我对服务器的响应不感兴趣,我可以删除以下代码吗?

考虑到代码,就其本身而言,会导致 a java.net.ProtocolException,有没有办法仍然获取服务器响应并执行conn.getOutputStream();?以什么顺序?除了明显的报告问题之外,没有得到回应的后果是什么?

0 投票
0 回答
227 浏览

c# - 使用 svcutil 生成使用 ServiceHost 托管的命名管道服务的 WCF 客户端时出现错误

我正在使用以下命令:

svcutil.exe /language:c# /out:agnServiceClient.cs /config:app.config net.pipe://localhost/agnService

ProtocolException在服务器上得到以下信息:

http://www.w3.org/2005/08/addressing/anonymous需要流安全 ,但没有协商安全上下文。这可能是由于远程端点在其绑定中缺少 StreamSecurityBindingElement 造成的。

服务器配置如下:

代码就这么简单:

启动代码:

有什么提示吗?

0 投票
1 回答
1375 浏览

java - java.net.ProtocolException:意外的状态行:

我想使用 HTTP GET 方法获取数据。但是反应是错误的

如何解决?


主要问题不在此代码中。它实际上与环形振荡器相关。在环形振荡器中,有零延迟的组合循环,它导致了这个问题

0 投票
1 回答
3926 浏览

android - okhttp3 给出协议异常错误 - 后续请求太多:21

我有实现 Authenticator 接口的 TokenAuthenticator 类。

TokenAuthenticator 类如下所示:

而创建服务的方法是:

我得到这个例外:

我在改造和okHttp3中使用,我需要做什么???