Net::Telnet Timeout

Net::Telnet Timeout

am 02.08.2007 23:24:16 von stephen.j.smith

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




charset=3Dus-ascii">
6.5.7652.24">
Net::Telnet Timeout




FACE=3D"Arial">I FACE=3D"Arial">’ FACE=3D"Arial">m seeking clarification on how the timeout works in reads =
within Net::Telnet. Consider this code snippet
LANG=3D"en-us">.





LANG=3D"en-us">        FACE=3D"Arial">##



LANG=3D"en-us">        FACE=3D"Arial">## Use getline to get switch response. Times out on last =
line; no newline



LANG=3D"en-us">        FACE=3D"Arial">##



LANG=3D"en-us">        FACE=3D"Arial">$t->print("show output");



LANG=3D"en-us">        FACE=3D"Arial">while ($result =3D $t->getline(Errmode =3D> =
"return"))



LANG=3D"en-us">        FACE=3D"Arial">{



LANG=3D"en-us">        =
        FACE=3D"Arial">print DMPFILE "$result";



LANG=3D"en-us">        FACE=3D"Arial">}



LANG=3D"en-us">        FACE=3D"Arial">$result =3D $t->errmsg;



LANG=3D"en-us">        FACE=3D"Arial">if ($result eq "read =
timed-out")



LANG=3D"en-us">        FACE=3D"Arial">{



LANG=3D"en-us">        =
        FACE=3D"Arial">$result =3D $t->get(Timeout =3D> =
3);        ## Get end of read block =
without newline



LANG=3D"en-us">        =
        FACE=3D"Arial">print DMPFILE "$result\n";



LANG=3D"en-us">        FACE=3D"Arial">}



LANG=3D"en-us">        FACE=3D"Arial">else



LANG=3D"en-us">        FACE=3D"Arial">{



LANG=3D"en-us">        =
        FACE=3D"Arial">print DMPFILE "Getline error message =3D =
$result\n";



LANG=3D"en-us">        =
        FACE=3D"Arial">exit(102);



LANG=3D"en-us">        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
FACE=3D"Arial">“ FACE=3D"Arial">show output SIZE=3D2 FACE=3D"Arial">” SIZE=3D2 FACE=3D"Arial"> command. When the application is created it =
will be interfacing with a telecommunications switch and will be =
requesting data
FACE=3D"Arial">. FACE=3D"Arial"> FACE=3D"Arial">D FACE=3D"Arial">ue to the size of the data and slow communications =
link
FACE=3D"Arial">it FACE=3D"Arial">will take 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.



Any =
experience in this area is welcome.
LANG=3D"en-us">



LANG=3D"en-us"> LANG=3D"en-us"> LANG=3D"en-us"> FACE=3D"Arial">Steve







------_=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0429884292==--