in reply to telnet to a vendor app hangs
I haven't tried it personally, but I'd recommend starting with Net::Telnet rather than writing your own socket-level interface. According to the docs, you can specify a timeout, so it may be just the ticket.
In Section
Seekers of Perl Wisdom