tags:

views:

203

answers:

3

A system is trying to telnet to a server a number of times continueously. Is there a possiblity that the process trying to telnet may crash due to buffer overflow? My situation is a perl program in a loop trying 500 times in 10 seconds opening a telnet connection and closing.

A: 

We'd need to see the Perl program (and I'm assuming you have it otherwise how would you know it's Perl).

One possibility is that the Perl script is not recognizing the login strings presented by your telnet daemon and so is shutting down the connection and retrying.

I'm not sure why you'd think it was a buffer overflow (unless you have information that we don't). It seems to me that if Perl (the interpreter, not the script) had a buffer overflow, it would just crash and there would be no retries (assuming there's not something else retrying the script).

If you think your script has a buffer overflow problem, again we'd need to see it to help you out.

paxdiablo
My next question is why you have to hit telnetd that hard. Do you really need to be notified of problems with the server within 1/50th of a second after they occur. Would it not make more sense to try once every 10 seconds, for example?
paxdiablo
+1  A: 

Telnetting 500 times in 10 seconds shouldn't crash your client program, but I doubt your telnet and login processes on the server can keep up with that kind of a connection rate. You need to figure out a way to leave the telnet connection open or switch to a protocol designed for polling, such as SNMP.

All that said, you didn't indicate what Telnet library or program you're using, so the possibility is certainly out there that it is buggy.

In short, I don't think your use case is really in spec for Telnet.

easel
A: 

Why can't you just leave the telnet connection open?

I would open just a single telnet connection and leave it open and use it to send and receive data. If there is no response in a specified timeout than close it and open it again.

Kalmi