Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-12-2013, 12:10 PM   PM User | #1
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Open program and send data to it

hey!
So.. I wanna make a program to be executed remotely on another computer. Like i command from my computer to open a video file at my laptop and then send data to it like "Enter" key so that the window will be maximized.

Could u guys post some documentation links step by step of what should i do?

thanks a lot!

ps: i tried to do this with php exec() function but it backfired n there i explained a little more about my problem hope it helps! http://www.codingforums.com/showthread.php?t=285649
sorlaker is offline   Reply With Quote
Old 01-12-2013, 05:08 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Using Java's RMI would probably be the easiest approach. Here's a tutorial from oracle with the overview of the RMI methodologies and an example: http://docs.oracle.com/javase/tutorial/rmi/index.html
You'll still need to go over the documentation of the KMPlayer with a fine tooth comb as well. It should have documented the command line functionality, and even better if you can pipe commands to a running gui through the process itself.
The fun part is this: it may not even be this complex to perform. With many media servers nowadays they have built in RSTP servers (I think that's the protocol it uses). This means they would have a listener on a socket for the source machine which you can open to and send commands to the running RSTP directly. You'll need to check the player's docs for information about this, and learn the RSTP communication RFC as well (there should be a link on wiki to the rfc as well). Some apps like VLC also have a built in remote control interface to take this layer away, although I've never attempted to use it.
And before you ask, if you have a running RSTP for the player, yes you could use PHP as well. Although for anything interactive especially in a local lan I'd suggest you don't use a web based language for that task.
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
sorlaker (01-12-2013)
Old 01-13-2013, 12:33 AM   PM User | #3
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Fou-lu let's start with basics first pls. How do i open a video file with kmplayer? All i've seen googleing* was opening a video with default video player. So.. besides changing the system's default player how can i make kmplayer (or any other program) open a file using Java ofc

thanks a lot!


ps: can i use sockets instead of those java rmi?

Last edited by sorlaker; 01-13-2013 at 01:17 AM..
sorlaker is offline   Reply With Quote
Old 01-13-2013, 05:31 AM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
The sockets and RMI are two different things. The RMI would use sockets, but its designed to communicate between two different machines. Think like a chat client.
Java is quite capable of opening sockets.

I can't tell you how to open a file with the KMPlayer, I just don't use it. VLC and Media player both accept a filename in the argument when launching it, so I presume KMPlayer would as well.
Fou-Lu is offline   Reply With Quote
Old 01-14-2013, 12:27 AM   PM User | #5
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Fou-Lu could u tell me if java applets could do what that php exec() couldn't?
sorlaker is offline   Reply With Quote
Old 01-14-2013, 03:12 AM   PM User | #6
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Unless you create an RMI, than the applet would only work on the client loading it. Applets are Client side executed as opposed to PHP which is Server side. You also need to sign the applet if you intend to act with privilege on the remote machine. The applet is like HTML is to the browser.

So yes, you can use the applet on the client, but no you cannot connect remotely to it directly like that.
Fou-Lu is offline   Reply With Quote
Old 01-16-2013, 04:31 AM   PM User | #7
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Since i'm a noob and i was quite in a hurry i could do that basically using sockets n JFrame.

Did that by watching chat services tutorial.
1 side was me writing commands.
On the other side my laptop running it.

But i got stuck on an issue.
I created the method showFolders(); // to receive all the folders from my laptop to my pc.

So whats the best to to display that for me? I thought about something like buttons containing those folder names but since there are many folder i couldn't scrollable the getContentPane();

Do you have any better idea? Or help fix solve this problem.

What i want is like a width=500 height=400 JFrame to display buttons like :
"Inception"
"LimitLess"
"Avatar"
"Iron Man"
scrollable since there r many titles so that i could click on one of them to be played on my laptop.

thanks in advance

ps (edit1) : AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW MANNN java's gui so boring!! wish i could use css on it. :P

ps (edit2) : Solved it simply using Sockets. thanks

Last edited by sorlaker; 01-16-2013 at 05:38 PM..
sorlaker is offline   Reply With Quote
Old 01-16-2013, 08:10 PM   PM User | #8
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,662
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
You sorta can use CSS, but they are hard properties in Java. You're better off using a LookAndFeel manager instead. Customizing the actual L&F is quite a bit of work in Java; its not simple like CSS and HTML is (but that's all HTML/CSS' job is, so I think that's a fair trade).
You can see some screenshots and download links for a few themes here: http://geeknizer.com/best-java-swing...casual-top-10/

Scrolling in Java gui is very simple. Simply add the scrollable content to a JScrollPane and add that panel to the frame instead of the large component. Without customizing a thing, the JScrollPane's job is to determine the viewport size you have and add scrollable content to it.
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 01-19-2013, 09:09 PM   PM User | #9
sorlaker
Regular Coder

 
Join Date: Dec 2009
Posts: 166
Thanks: 23
Thanked 1 Time in 1 Post
sorlaker has a little shameless behaviour in the past
Fou-Lu i've found a better but painfull way to do that using using php and java sockets. It worked like a charm. Thanks for your help!
sorlaker is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:40 AM.


Advertisement
Log in to turn off these ads.