frankmorgner / vsmartcard

umbrella project for emulation of smart card readers or smart cards
http://frankmorgner.github.io/vsmartcard/
684 stars 197 forks source link

avoid unnecessary RTTs for communication #252

Closed mildsunrise closed 1 year ago

mildsunrise commented 1 year ago

when using remote-reader + vpcd, the request is sent by doing 2 sendall operations on the socket (one for the length, another for the data). this splits the request into 2 TCP segments, meaning Nagle's algorithm kicks in and holds the second segment until an ACK for the first is received. this introduces an unnecessary RTT.

remote-reader also does this on their end, which introduces another RTT. these RTTs can end up representing most of the time the user spends waiting (with Android they're usually on the order of hundreds of milliseconds).

in conclusion, this makes overall operation ~3x faster. for example, in my case pkcs15-tool -c drops from 6.3 seconds to about 2 seconds.

frankmorgner commented 1 year ago

great, thank you