ó Afc@s]ddlZddlZddlTd ZdZd„Zd„Zd„Zd „ZeƒdS( iÿÿÿÿN(t*iPÃi*icCsdttjƒdkrtƒntjddkr<tƒn$tjddkrYtƒntƒdS(Niis-ss-c(tlentsystargvtusagetservertclient(((s//usr/lib64/python2.7/Demo/sockets/throughput.pytmains   cCs'tjt_dGHdGHtjdƒdS(Ns*Usage: (on host_A) throughput -s [port]s7and then: (on host_B) throughput -c count host_A [port]i(Rtstderrtstdouttexit(((s//usr/lib64/python2.7/Demo/sockets/throughput.pyR"s cCsÓttjƒdkr+ttjdƒ}nt}tttƒ}|jd|fƒ|j dƒdGHxg|j ƒ\}\}}x |j t ƒ}|sœPn~qƒW|j dƒ|jƒdG|GdG|GHqhWdS(NitisServer ready...sOK s Done withtport(RRRtevaltMY_PORTtsockettAF_INETt SOCK_STREAMtbindtlistentaccepttrecvtBUFSIZEtsendtclose(R tstconnthostt remoteporttdata((s//usr/lib64/python2.7/Demo/sockets/throughput.pyR)s"   c Cs¬ttjƒdkrtƒntttjdƒƒ}tjd}ttjƒdkrpttjdƒ}nt}dtdd}tjƒ}t t t ƒ}tjƒ}|j ||fƒtjƒ}d}x'||krý|d}|j |ƒq×W|jdƒtjƒ} |jtƒ} tjƒ} | GHdG|G|G|G| G| GHd G||G||G| |G| | GHd G| |GHd Gtt|d | |dƒGd GHdS(Niiitxis is Raw timers:s Intervals:sTotal:s Throughput:gü©ñÒMbP?sK/sec.(RRRRtintR RRttimeRRRtconnectRtshutdownRtround( tcountRR ttestdatatt1Rtt2tt3titt4Rtt5((s//usr/lib64/python2.7/Demo/sockets/throughput.pyR>s6         % !izÃ( RR RRRRRRR(((s//usr/lib64/python2.7/Demo/sockets/throughput.pyts