[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Narinder Singh Sahni |
Subject: |
|
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
(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:
connected
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
Associate Prof.
Centre for computational Biology and Bioinformatics
Jawaharlal Nehru University
New Delhi -110067
India
_____________________________________________________
#!/usr/bin/perl -w
# send.pl
# 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
perl\\n');fclose(fid);";
my $cmd = "whos";
print scalar(localtime);
#print $sock "!!!x";
print $sock pack("N",length($cmd));
print $sock $cmd;
close $sock;
_______________________________________________________
- [no subject],
Narinder Singh Sahni <=