After transmitting many normal packets in response to a post request,the server suddently sent [rst,ack]
The cilent (emulator of android studio) makes a post request to a remote server (port:80, built by Flask in centos7). The connection was built successfully, and the server began to transmit a lot of packets to the cilent.
At first, everything seemed to go well: the cilent has received many normal packets and read infomation from them. But suddently, the server sent a packet flagged with [RST,ACK], and the cilent got an erro "java.net.SocketException: Connection reset".
(screenshot: https://imgur.com/6l7PQ8Z) (download the pcapng: https://easyupload.io/vophjy, password:wireshark) (Packets were captured on client side. I also captured both on server side and client side at the meantime, and uploaded them in the "update" section below)
My code in Android Studio (worte with JAVA) is like this:
..........
InputStream in=connection.getInputStream(); //connection is a HttpURLConnection
StringBuilder strbd =new StringBuilder();
byte[] bbuf=new byte[1024];
while(in.read(bbuf)>0){
strbd.append(new String(bbuf,0,in.read(bbuf)).trim());
}
} catch (IOException e) {
e.printStackTrace();
Log.d("ppppx", String.valueOf(strbd.length()));//output:7784, or 9187, or 10079, etc...
}
............
I have tried everything I can to find the reason, but failed, due to my limited knowledge in TCP/IP protocol. I will be really grateful if you can give me an enlightenment, thanks!
----------------------------------------------------------update---------------------------------------------------------------
I just captured the packets both on the client side and the server side at the meantime. I do this work twice, and upload all of them ( view the images and download the packets on http://118.89.144.241/)
May I ask how you made the capture? It is interesting to me that there are frames from both sides that are shorter than the minimum ethernet frame length. Normally you would see that only for outgoing packets. But maybe the trace was made in a virtualized environment where the padding of incoming packets is stripped before being forwarded.
Have you done any logging on the server side?
https://stackoverflow.com/questions/4...
@SYN-bit Hi, I made the capture on the client side. My wireshark captured all the packets under the "wifi" option ( which may mean all the packets from my computer will be captured? I assume). And I take some time to upload some packets which were captured on both server side and client side at the meantime on http://www.vainquit.com/download. If you are interested.
@bubbasnmp emmm....the original answer didn't include the log of the server side. And I just re-captured them on both server side (by tcpdump) and client side(by wireshark) on http://www.vainquit.com/download.