Phoenix.pm: Net::Telnet

johnb johngnub at cox.net
Wed Jan 14 21:05:48 CST 2004


Use net::telnet
or
us a shell telnet scr...examples on request...

On Wednesday, January 14, 2004, at 05:40 PM, Matt Alexander wrote:

> On Wed, 14 Jan 2004, Scott Walters wrote:
>
>> There is an example of raw sockets on phoenix.pm.org website,
>> but IO::Socket::INET is about the right level of abstraction for
>> what you're doing. Clearly Net::Telnet is too much of the wrong
>> abstraction. Raw sockets are usually too little abstraction.
>>
>>> From the man page:
>>
>>               $sock = IO::Socket::INET->new(PeerAddr => 
>> 'www.perl.org',
>>                                             PeerPort => '80',
>>                                             Proto    => 'tcp');
>>
>> You can then print to $sock, $sock->print("foo!\n"), read from it,
>> read $sock, my $buffer, 8192, read lines from it, my $line = readline 
>> $sock,
>> and so on, just like a normal IO::Handle.
>
> I ended up using raw sockets and I can now grab all the data, but I'm 
> not
> sure how to disconnect after a certain period of time.  The device I'm
> connecting to doesn't give any indication of when it's done sending 
> data.
> So I basically need to grab everything, set an overall time limit of 
> say,
> 5 seconds, and then disconnect after that time limit.
> Any suggestions?
> Thanks,
> ~M
>




More information about the Phoenix-pm mailing list