[英]How to get response length before reading response from socket in java
I am working on MML server, my Task is to read response from MML server. 我在MML服务器上工作,我的任务是从MML服务器读取响应。 In this case, there is no "End of Response" Character in response.
在这种情况下,响应中没有“响应结束”字符。 How would i know that that response is ended?
我怎么知道该回应已结束? Is there any kind of technique to get response length before reading the response.
在读取响应之前,是否有任何一种技术可以获取响应长度。 by doing this i want to break my while loop using the response length.
通过这样做,我想使用响应长度打破while循环。
while(true)
{
try
{
char temp = (char) is.read();
System.out.println(temp);
responseLine = responseLine + temp;
}
catch(Throwable e)
{
e.printStackTrace();
break;
}
}
I don't know MML, but with streams in general, the ways to recognize end of a message are: 我不知道MML,但是对于一般的流,识别消息结尾的方法是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.