|
Home > Archive > Unix Programming > June 2007 > Remote access from a C++ application
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Remote access from a C++ application
|
|
| Tim Frink 2007-06-20, 7:22 am |
| Hi,
I've a C++ application that is written for Linux (and
does not run under Solaris).
The application generates an linear programming (LP)
input file that is passed to the ILP solver lp_solve.
lp_solve is invoked from the application by the function
"system". The result of lp_solve is an output file that
is automatically passed to another application (via
"system") from my C++ application.
Due to the high complexity of my LP problems, lp_solve
sometimes takes very long. On a Solaris machine that
is accessible with ssh from the Linux box, I've cplex,
a much faster LP solver. My idea is to use this Solaris
cplex instead of the Linux lp_solve.
One solution would be to copy the LP input file via
scp to the Solaris machine, invoke via ssh "cplex"
and copy the output cplex file with scp back to the
Linux machine where the file is required. This could
be all implemented from the Linux C++ application using
the "system" function. But as you can imagine this
file copying is quiet tedious. Do you see any better
solution?
Regards,
Tim
| |
| Maxim Yegorushkin 2007-06-20, 7:22 am |
| On 20 Jun, 11:56, Tim Frink <plfr...@yahoo.de> wrote:
> Hi,
>
> I've a C++ application that is written for Linux (and
> does not run under Solaris).
>
> The application generates an linear programming (LP)
> input file that is passed to the ILP solver lp_solve.
> lp_solve is invoked from the application by the function
> "system". The result of lp_solve is an output file that
> is automatically passed to another application (via
> "system") from my C++ application.
> Due to the high complexity of my LP problems, lp_solve
> sometimes takes very long. On a Solaris machine that
> is accessible with ssh from the Linux box, I've cplex,
> a much faster LP solver. My idea is to use this Solaris
> cplex instead of the Linux lp_solve.
>
> One solution would be to copy the LP input file via
> scp to the Solaris machine, invoke via ssh "cplex"
> and copy the output cplex file with scp back to the
> Linux machine where the file is required. This could
> be all implemented from the Linux C++ application using
> the "system" function. But as you can imagine this
> file copying is quiet tedious. Do you see any better
> solution?
No need for copying.
$ echo "whatever" | ssh <some remote host> grep what
whatever
| |
| Tim Frink 2007-06-20, 7:22 am |
| On Wed, 20 Jun 2007 04:11:52 -0700, Maxim Yegorushkin wrote:
> No need for copying.
>
> $ echo "whatever" | ssh <some remote host> grep what
> whatever
Would "echo" also work without problems for large files
with 100k lines?
| |
| Rainer Temme 2007-06-20, 7:22 am |
| Tim Frink schrieb:
[vbcol=seagreen]
> Would "echo" also work without problems for large files
> with 100k lines?
You would use "cat" then.
| |
| Maxim Yegorushkin 2007-06-20, 7:22 am |
| On 20 Jun, 12:14, Tim Frink <plfr...@yahoo.de> wrote:
> On Wed, 20 Jun 2007 04:11:52 -0700, Maxim Yegorushkin wrote:
>
>
> Would "echo" also work without problems for large files
> with 100k lines?
For files use cat instead of echo. The pipe and redirection in:
$ cat <file> | ssh <wherever> <whatever> > <local output file>
Do the thing that scp would do.
| |
| Rainer Weikusat 2007-06-20, 7:22 am |
| Maxim Yegorushkin <maxim.yegorushkin@gmail.com> writes:
> On 20 Jun, 12:14, Tim Frink <plfr...@yahoo.de> wrote:
>
> For files use cat instead of echo. The pipe and redirection in:
>
> $ cat <file> | ssh <wherever> <whatever> > <local output file>
>
> Do the thing that scp would do.
Since the ssh is reading from its standard input, it is possible to
use a redirection without cat, eg
ssh kbwi sed 's/7/9/' </var/log/syslog
Kbwi is one of the servers of my employer. This particular command
copies the local /var/log/syslog file from my machine in Mainz/
Germany to a computer in New Jersey, runs sed there to replace every seven
with a nine and copies the output back to me. A extraordinary useless
way to waste transatlantic bandwidth :-).
| |
|
|
"Rainer Weikusat" <rweikusat@mssgmbh.com> wrote in message
news:87tzt2vnp4.fsf@fever.mssgmbh.com...
> Maxim Yegorushkin <maxim.yegorushkin@gmail.com> writes:
>
> Since the ssh is reading from its standard input, it is possible to
> use a redirection without cat, eg
>
> ssh kbwi sed 's/7/9/' </var/log/syslog
>
> Kbwi is one of the servers of my employer. This particular command
> copies the local /var/log/syslog file from my machine in Mainz/
> Germany to a computer in New Jersey, runs sed there to replace every seven
> with a nine and copies the output back to me. A extraordinary useless
> way to waste transatlantic bandwidth :-).
I assume this is a contrived example :-).
| |
| Ian Collins 2007-06-20, 7:29 pm |
| Tim Frink wrote:
> Hi,
>
> I've a C++ application that is written for Linux (and
> does not run under Solaris).
>
Can it be recompiled on Solaris?
--
Ian Collins.
| |
| Tim Frink 2007-06-21, 7:23 am |
| On Wed, 20 Jun 2007 14:02:15 +0200, Rainer Weikusat wrote:
> Since the ssh is reading from its standard input, it is possible to
> use a redirection without cat, eg
>
> ssh kbwi sed 's/7/9/' </var/log/syslog
How would the command looks like if you would like to use another
local file as output, i.e. you would copy /var/log/syslog to kbwi
and would like to get the result back in a local file?
| |
| Tim Frink 2007-06-21, 7:23 am |
| On Wed, 20 Jun 2007 04:26:37 -0700, Maxim Yegorushkin wrote:
> On 20 Jun, 12:14, Tim Frink <plfr...@yahoo.de> wrote:
>
> For files use cat instead of echo. The pipe and redirection in:
>
> $ cat <file> | ssh <wherever> <whatever> > <local output file>
I forgot the second input file. My remote application requires both
the command file that can be handled as described above. But in addition,
one of the commands tells the remote application to read an input file
that is somewhere locally on the remote machine. Do you see any chance
how to handle this case, i.e. to read the input for the remote application
that is a local file on the machine calling ssh?
Regards,
Tim
| |
| Rainer Weikusat 2007-06-21, 7:23 am |
| Tim Frink <plfriko@yahoo.de> writes:
> On Wed, 20 Jun 2007 14:02:15 +0200, Rainer Weikusat wrote:
>
>
> How would the command looks like if you would like to use another
> local file as output, i.e. you would copy /var/log/syslog to kbwi
> and would like to get the result back in a local file?
ssh kbwi sed 's/7/9/' </var/log/syslog >/tmp/output
| |
| Tim Frink 2007-06-22, 7:23 am |
| On Thu, 21 Jun 2007 10:34:45 +1200, Ian Collins wrote:
> Can it be recompiled on Solaris?
Unfortunately not due to some 3rd party libraries that run
only with Linux.
|
|
|
|
|