[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]

From: Narinder Singh Sahni
Date: Thu, 28 Sep 2006 17:58:02 +0530

Hei there,

My question is related to running octave from Perl. This particular problem has 
been previously taken up before 
( The Perl code 
suggested in the URL is also copied below. In addition, I am running the 
application on cygwin,  GNU Octave, version 2.1.71 (i686-pc-cygwin), and Perl, 
v5.8.7 built for cygwin-thread-multi-64int. Octave has been added as port 10000 
in the /etc/services file.

This is what I am doing.
1) starting octave and starting the listening session using: 

octave output: listening to port 2000.
                Trying to accept.

2) Running the perl script (pasted below), perl, gives:
server: got connection from
trying to accept
waiting for command
received command !!!x after 1us
read 92 byte command in 1us
evaluating (92) fid = fopen('temp.txt','wb'); fprintf(fid,'this is octave 
running from perl\n');fclose(fid);
read socket returned 0
child is exitting
reaping all children
done reaping children
failed to accept
Octave pid: 612
accept: Interrupted system call
trying to accept

Thus the connection is there, and the cmd line is copied in octave, but then 
nothing happens except of-course the socket returning 0. I am new at this, so I 
am unable to decipher where the error lies. Since the connection is taking 
place, and octave is listening, is seems to be related to some permissions that 
octave needs to execute the cmd.

I am planning to use it as a general purpose solution for running various 
applications including octave and R. Any assistance would be highly 

Narinder S. Sahni
Associate Prof. 
Centre for computational Biology and Bioinformatics
Jawaharlal Nehru University
New Delhi -110067

#!/usr/bin/perl -w
# a simple client using IO:Socket

use IO::Socket;
$sock = IO::Socket::INET->new(PeerAddr => 'localhost:10000');
$sock or die "no socket :$!";
print $sock;

#my $cmd = "fid = fopen('temp.txt','wb'); fprintf(fid,'this is 
my $cmd = "whos";
print scalar(localtime);
#print $sock "!!!x";
print $sock pack("N",length($cmd));
print $sock $cmd;
close $sock;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]