Narinder Singh Sahni
narinder at mail.jnu.ac.in
Thu Sep 28 07:28:02 CDT 2006
My question is related to running octave from Perl. This particular problem has been previously taken up before (http://velveeta.che.wisc.edu/octave/lists/help-octave/2006/989). 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: >listen(10000,’127.0.0.1’,’debug’).
octave output: listening to port 2000.
Trying to accept.
2) Running the perl script (pasted below), perl test1.pl, gives:
server: got connection from 127.0.0.1
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 appreciated.
Narinder S. Sahni
Centre for computational Biology and Bioinformatics
Jawaharlal Nehru University
New Delhi -110067
# a simple client using IO:Socket
$sock = IO::Socket::INET->new(PeerAddr => 'localhost:10000');
$sock or die "no socket :$!";
#my $cmd = "fid = fopen('temp.txt','wb'); fprintf(fid,'this is perl\\n');fclose(fid);";
my $cmd = "whos";
#print $sock "!!!x";
print $sock pack("N",length($cmd));
print $sock $cmd;
More information about the Help-octave