This is a multi-part message in MIME format.
--===============0429884292==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C7D54B.7AC22CA5"
This is a multi-part message in MIME format.
------_=_NextPart_001_01C7D54B.7AC22CA5
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I'm seeking clarification on how the timeout works in reads within
Net::Telnet. Consider this code snippet.
##
## Use getline to get switch response. Times out on last line;
no newline
##
$t->print("show output");
while ($result =3D $t->getline(Errmode =3D> "return"))
{
print DMPFILE "$result";
}
$result =3D $t->errmsg;
if ($result eq "read timed-out")
{
$result =3D $t->get(Timeout =3D> 3); ## Get end of
read block without newline
print DMPFILE "$result\n";
}
else
{
print DMPFILE "Getline error message =3D $result\n";
exit(102);
}
If I have the default 10 second timeout, does it apply to each getline()
or does it apply to the time required for the total response to the
"show output" command. When the application is created it will be
interfacing with a telecommunications switch and will be requesting
data. Due to the size of the data and slow communications link it will
take a long time for the command to complete. I want to design the most
effective means to recognize true timeouts, but I need to allow for the
inherent slowness of communicating with the switch.
Any experience in this area is welcome.
Steve
------_=_NextPart_001_01C7D54B.7AC22CA5
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7652.24">
<TITLE>Net::Telnet Timeout</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">I</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">’</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">m seeking clarification on how the timeout works in reads =
within Net::Telnet. Consider this code snippet</FONT></SPAN><SPAN =
LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">.</FONT></SPAN></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">##</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">## Use getline to get switch response. Times out on last =
line; no newline</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">##</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">$t->print("show output");</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">while ($result =3D $t->getline(Errmode =3D> =
"return"))</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">{</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Arial">print DMPFILE "$result";</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">}</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">$result =3D $t->errmsg;</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">if ($result eq "read =
timed-out")</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">{</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Arial">$result =3D $t->get(Timeout =3D> =
3); ## Get end of read block =
without newline</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Arial">print DMPFILE "$result\n";</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">}</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">else</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">{</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Arial">print DMPFILE "Getline error message =3D =
$result\n";</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> =
<FONT SIZE=3D2 =
FACE=3D"Arial">exit(102);</FONT></SPAN></P>
<P DIR=3DLTR><SPAN =
LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">}</FONT></SPAN></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">If I =
have the default 10 second timeout, does it apply to each getline() or =
does it apply to the time required for the total response to =
the</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">“</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">show output</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
SIZE=3D2 FACE=3D"Arial">”</FONT></SPAN><SPAN LANG=3D"en-us"><FONT =
SIZE=3D2 FACE=3D"Arial"> command. When the application is created it =
will be interfacing with a telecommunications switch and will be =
requesting data</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">.</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial"></FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">D</FONT></SPAN><SPAN LANG=3D"en-us"><FONT SIZE=3D2 =
FACE=3D"Arial">ue to the size of the data and slow communications =
link</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">it</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT SIZE=3D2 =
FACE=3D"Arial">will take</FONT></SPAN><SPAN LANG=3D"en-us"> <FONT =
SIZE=3D2 FACE=3D"Arial">a long time for the command to complete. I want =
to design the most effective means to recognize true timeouts, but I =
need to allow for the inherent slowness of communicating with the =
switch.</FONT></SPAN><SPAN LANG=3D"en-us"></SPAN></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"><FONT SIZE=3D2 FACE=3D"Arial">Any =
experience in this area is welcome.</FONT></SPAN><SPAN =
LANG=3D"en-us"></SPAN></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"><B><I></I></B></SPAN><SPAN =
LANG=3D"en-us"><B><I></I></B></SPAN><B><I><SPAN =
LANG=3D"en-us"></SPAN></I></B><A NAME=3D""><B><I><SPAN =
LANG=3D"en-us"><FONT COLOR=3D"#000000" =
FACE=3D"Arial">Steve</FONT></SPAN></I></B></A></P>
<P DIR=3DLTR><SPAN LANG=3D"en-us"></SPAN></P>
</BODY>
</HTML>
------_=_NextPart_001_01C7D54B.7AC22CA5--
--===============0429884292==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0429884292==--
