Hi Monks,

I hope you can help, as I've been looking everywhere for an answer!

I have a program which connects to a remote server (using Net::Telnet) and sends test transactions. I have a requirement to measure the various stages of the transaction. I can do this using Time::HiRes, however I have a problem in that when I do telnet->close, the close is handed off to the TCP stack and the program loops round again sending off a new transaction before the socket close is completely finished (this is over GPRS so it takes a while!).

The prblem is that $s2 and $3 are simply how long it takes the program to hand the close off to the TCP stack rather than the actual time it took to close the socket.

Is there any way to force the Perl program to wait for ACKs and FIN packets rather then letting the TCP stack handle them? I would be willing to recode my program using IO::Socket::INET if it helps at all.
##open socket $t0 = [gettimeofday]; #Start overall txn timer $s0 = [gettimeofday]; #Start socket creation timer &connect_server($ip,$port); #Make a telnet connection to $s1 = [gettimeofday]; #End socket creation timer ##send / receive msgs $m0 = [gettimeofday]; #Start TXN timer for message payloads $telnet->put("$octmsg1"); #"put" 11st octal txn on the wire (send n +o CR) $telnet->waitfor(/02.*/); #Expect a response @list = $telnet->get; #Gather the response $telnet->put("$octmsg2"); #"put" 2nd octal txn on the wire (send no + CR) $m1 = [gettimeofday]; #End TXN timer for message payloads ##Close socket $s2 = [gettimeofday]; #Start FIN timer $telnet->close; $s3 = [gettimeofday]; #End FIN timer t1 = [gettimeofday]; #End overall txn timer
I'm running on XP, but if its any easier I can also run on Linux

In reply to Waiting for ACKs and FINs by cstrong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.