Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OKHttp get http transferStart time and transferDone tiem under Android

I'm trying port a system from Linux to Android, something like http trace, Likely httpstat outputs

  DNS Lookup   TCP Connection   TLS Handshake   Server Processing   Content Transfer
[    302ms  |         416ms  |       1353ms  |            403ms  |             0ms  ]
            |                |               |                   |                  |
   namelookup:302ms          |               |                   |                  |
                       connect:719ms         |                   |                  |
                                   pretransfer:2079ms            |                  |
                                                     starttransfer:2483ms           |
                                                                                total:2483ms

I could make a self tls stack replace initial one so that I could get TLS Handshake start and over time, And I need three data like

"first byte time": FirstResponseByte

"download time": (for the content was downloaded Finish)

"redirect time": (if have redirect)

And for now I'm not really familiar with OKHttp, And I searched It seems did not expose these data.

So Is there any way I could get there params? Or even with Other implementations like HttpUrlConnection?

like image 568
d0ye Avatar asked Mar 16 '26 03:03

d0ye


1 Answers

Take a look at EventListener.

like image 181
Jesse Wilson Avatar answered Mar 17 '26 16:03

Jesse Wilson