Search this Website

 

Ubuntu

UNIX

inappropriate ioctl for device at

Category: UNIX-Unix Beginner

inappropriate ioctl for device at

i am getting the error "inappropriate ioctl for device" at croak (on 5th line inside the subroutoine given below). anybody has any idea what could be the reason for that. it do succeeds sometime and other times fail with "inappropriate ioctl for device":

this is a subroutine in my program which is trying to use to open a telnet connection with the host. it's checking whether it already has the telnet connection, so that it doesn't open another one:

sub t()
{ # we have a telnet session, but host doesn't respond
if ($t and not scalar $t->cmd("echo hello, world")) {
$self->{telnet} = undef;
#error
croak "telnet poke (\"echo hello, world\") failed: ", $t->errmsg();
}

if (not $t) {
debug "telnet: connecting to " . $self->{host} . "\n";

$t = new net::telnet(timeout => $self->{cmdtimeout},
errmode => 'return')
or croak "telnet: new failed: $@\n";

# $t->dump_log("dump.out.$$");
$t->open(host => $self->{host}, port => 2342)
or croak "telnet: open failed: $@";
# send a newline so we can look at the prompt
my $oldprompt = $t->prompt("/.*:/");
$t->cmd("\n") or
croak "telnet: newline failed: ", $t->errmsg();
} }

looking for some positive answers