Home > other >  Have a great god can help us to analyze why under this section of the wireshark server will be submi
Have a great god can help us to analyze why under this section of the wireshark server will be submi

Time:10-18


/* ** @ Title: getResult 
* @ Description: returns the
* @ param @ param data
* @ param @ return
* @ param @ throws the Exception set file
* @ return Map The return type
* @ throws
*/
@ SuppressWarnings (" deprecation ")
Private String the method getResponse (String reqXml, String transCode, String packageId) throws the Exception {
String proxyIp=Property. GetProperty (" ICBC. QPAY. PROXY. IP ");
String proxyPort=Property. GetProperty (" ICBC. QPAY. PROXY. PORT ");

Communicate with payment platform//3.
String singData=https://bbs.csdn.net/topics/HttpRequest.sendPost (proxyIp proxyPort, Property, getProperty (" ICBC. QPAY. SIGNSERVER "), reqXml, "INFOSEC_SIGN/1.0", true, "GBK");
SingData=https://bbs.csdn.net/topics/singData.substring (singData indexOf (" & lt; Sign>" ) + 6, singData. IndexOf (" & lt;/sign>" ));

//send the trade request
String param="Version=0.0.1.0 & amp; TransCode="+ TransCode +" & amp; BankCode="+ +" BankCode & amp; GroupCIS="+ GIS
+ "& amp; ID="+ ID +" & amp; PackageID PackageID="+ +" & amp; Cert=& amp; ReqData="HTTP://https://bbs.csdn.net/topics/+ URLEncoder. Encode (singData);

String resData=https://bbs.csdn.net/topics/HttpRequest.sendPost (proxyIp proxyPort, Property, getProperty (" ICBC. QPAY. HTTPSERVER "), param, "application/x - WWW - form - urlencoded", true, "GBK");

The results of the//decrypted
The String result=new String (Base64. Decode (resData. Split (" reqData="HTTP://https://bbs.csdn.net/topics/) [1])," GBK ");
The log. The debug (" return a message: {} ", result);

return result;
}

/* *
* @ Title: sendPost
* @ Description: TODO (here with a phrase to describe the role of this method)
* @ param @ param request url address
* @ param @ param param request parameter
* @ param @ param contentType
* @ param @ param useProxy whether to use a proxy
* @ param @ return set file
* @ return a String return type
* @ throws
*/
Public static String sendPost (String proxyIp, String proxyPort, url String, the String param, String contentType, Boolean useProxy, String charset) {
PrintWriter out=null;
BufferedReader in=null;
The String result="";
Try {
RealUrl URL=new URL (URL);
//the connection between the open and URL
URLConnection conn=null;
If (useProxy) {
/* structure Proxy objects, in order to apply to the way the web */
InetSocketAddress socketAddress=new InetSocketAddress (InetAddress getByName (proxyIp), an Integer. The parseInt (proxyPort));
The Proxy Proxy=new Proxy (Proxy. Type. HTTP, socketAddress);
Conn=realUrl. OpenConnection (proxy);
} else {
Conn=realUrl. OpenConnection ();
}

//set the general request attribute
Conn. SetRequestProperty (" the content-type, "contentType);
//conn. SetRequestProperty (" the Content - Length ", contentLength);
//conn. SetRequestProperty (" accept ", "*/*");
//conn. SetRequestProperty (" connection ", "Keep Alive -");
Conn. SetRequestProperty (" the user-agent ", "Jakarta Commons HttpClient/3.1");
//send a POST request must be set below two lines
conn.setDoOutput(true);
conn.setDoInput(true);
//get URLConnection object corresponding to the output stream
If (StringUtils. IsEmpty (charset)) {
Out=new PrintWriter (conn. GetOutputStream ());
} else {
Out=new PrintWriter (new OutputStreamWriter (conn. GetOutputStream (), charset));
}
//send the request parameter
Out. Print (param);
//flush the output stream buffer
out.flush();
//define BufferedReader the response of the input stream to read the URL
//in=new BufferedReader (new InputStreamReader (conn. GetInputStream (), charset));
If (StringUtils. IsEmpty (charset)) {
In=new BufferedReader (new InputStreamReader (conn. GetInputStream ()));
} else {
In=new BufferedReader (new InputStreamReader (conn. GetInputStream (), charset));
}
String line;
While ((line=in readLine ())!=null) {
The result +=line;
}
} the catch (Exception e) {
log.error(e.getMessage(), e);
Throw new TtyException (" abnormal, send a POST request ", e);
}
//use a finally block to close the output stream, the input stream
The finally {
Try {
If (out!=null) {
Out. The close ();
}
If (in!=null) {
in.close();
}
{} the catch (IOException ex)
Throw new TtyException (" shut down flow failures, ");
}
}
return result;
}



is read input stream and the code shown above, through BUFFERREADER READLNE implementation, but every time the return message read can only read half, at the back of the lost, the following is my wireshark caught communication records, in the last server emits an RST disconnect, and PUS twice before are not getting the right client response ACK, under the great god, please help analysis why the server will take the initiative to send RST

CodePudding user response:

Time interval from the point of view, not the client don't reply the server, but hasn't come yet and RST dropped by the server response, should be a server found some wrong RST,

CodePudding user response:

reference 1st floor kinkon007 response:
time interval from the point of view, not the client don't reply the server, but hasn't come yet and RST dropped by the server response, should be a server found some wrong RST,
so is likely to be the server problem? The other side of the technical personnel said network flow had better use an array of bytes to read, do not use the readline characters to read, otherwise easy to complain, but I didn't change to read the seemingly changed bytes

CodePudding user response:

Your top one, and didn't find the problem very vexed
  • Related