Measuring time of a telnet connect

Jack diederich jackdied at gmail.com
Wed Apr 15 04:08:57 EDT 2009


On Wed, Apr 15, 2009 at 3:41 AM, Fabian Lanze
<fabani_punkt_lanze at rwth_minus_aachen.de> wrote:
>
> I want to realize the following: I want to measure the time it takes to
> build up a telnet connection to a known host (ip/port). I tried to use
> subprocess.Popen to build the telnet connection and then to catch the
> "Trying to connect..." and "Connection established" output. But this
> didn't work - both had always the same timestamp (time.time()) - i think
> that's due to some buffers.
>
> Has anyone an idea how to solve this?

import time
import telnetlib

start = time.time()
conn = telnetlib.Telnet('localhost', 80)
print time.time() - start

-Jack



More information about the Python-list mailing list