File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes How to start Mat-Eng on a remote pc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "How to start Mat-Eng on a remote pc" Watch "How to start Mat-Eng on a remote pc" New topic
Author

How to start Mat-Eng on a remote pc

kimi lynn
Greenhorn

Joined: Jun 02, 2003
Posts: 27
Hello everybody,
Please bear with me if my question sounds really basic, I'm absolutely new to java Ok, here it goes what i'm trying to do.....
I wanting to start the matengine(Matlab) on another machine which is in the same network.Ip-adress and port no would be the inputs in-order to get connected to that machine.I'm able to start matlab(matengine) on my local pc by pressing a button.It works nice.ll'y, i would like to do on the remote pc too.I've some idea about sockets and have written a test program like, server and client.I keep running the server program on one machine and from the client I send a mesg to the server and its echoed back to the cient.
If some body has done such examples, pls gimmi the references or any other suggestions how i can start up with.All i want to do is to start the mateng on the remote pc.
Thanks for all your time
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi Kimi,
Well, if you've written a socket echo program, then in theory, you can execute your program in the server code in exactly the sameplace where you currently send the echo. You've got all the pieces, and could just put them together. Sun's Java tutorial has a section on sockets that should be useful.
It might be simpler, on the other hand, to write this as an RMI program. Java RMI, or Remote Method Invocation, is a nice system for writing distributed Java programs; see here for more info.


[Jess in Action][AskingGoodQuestions]
kimi lynn
Greenhorn

Joined: Jun 02, 2003
Posts: 27
Hello everybody,
Here how I've come up again w.r.t my first post.This program can start matlab on a server(localhost) where the ip-address and port no's are the inputs.As of now,the inputs are hard-coded in the code.When the IP-address matched with that of my local machine, then this works fine.I'm kinda confused in order to modify this code to make it working on a different machine.I've read that there should be server and client programs separately ,i.e server and client and the server program has to start first in-order to wait for the client to communicate.Am i right?? Could somebody pls help me.
Thanks for your time.
Heres the code under the action event

and the class file looks like:
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Just with a quick eye-ball your server program looks like a good start. Give it a main method put the class on your server machine and start it up. Then your client will be able to connect to it.
As you test, you may (or may not) find problems with how you're handling output from the command. I did this once (see Unfinished Example) and made two threads to read stdout and errout. Turned out to be a challenge to tell when both were truly done!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
kimi lynn
Greenhorn

Joined: Jun 02, 2003
Posts: 27
Thanks for the links.yeah,making a main method in the server class did the trick
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to start Mat-Eng on a remote pc