Question What's the easiest way to remotely control my program?

LeisureProgrammer

New member
Joined
Sep 5, 2009
Messages
4
Programming Experience
Beginner
I started learning programming using VB.NET a few months ago , and I'm not experienced enough with the Microsoft Visual Basic Library to get my answer. I have tried to do some Google searches, and still haven't found my answer.

Okay, suppose I want make a VB.NET program that displays the number "1" in a textbox when a button is pressed... I can easily make that program, but what if I want it to, on my remote command, display the number "2" instead when the button is pressed?

Is it possible to write code that reads gmail messages? I know that gmail is pretty open about it's SMTP and POP ports and stuff... (sorry, didn't learn much about e-mail yet :p )

If it is, it might be possible to; make it check a g-mail account every 10 minutes (timer), and if there is a new message in that account with the subject "now", then display the number "2" in the textbox whenever the button is pressed...

Or... I could get a text file hosted somewhere on the web, then get a timer to read the text file every now and then.
Which would be easier? Where would I find sample code to read an e-mail or text file which is on a web server?

If that's not the easiest way to remotely control a VB.NET program, what is? :confused:

Do you suggest I learn more about chatting applications and use one as a template? They're a bit complicated for beginners though, right?

I don't want to go learn about "System.Net.Sockets" and TCP listeners, etc.. right now, it seems too confusing to me. I'm a total noob at VB at the moment. :eek:

Thank you in advance.
 
Last edited:
Or... I could get a text file hosted somewhere on the web, then get a timer to read the text file every now and then.

Yes, do that. I do it with PHP. My PHP page passes commands from an SQL database which I update via my site, or using PHPMyAdmin.
 
If you go that route, you can do something like...

VB.NET:
Imports System.Net
Imports System.IO
...
        Dim myUrl As String = "http://www.google.com"

        Dim request As WebRequest
        Dim response As WebResponse
        request = WebRequest.Create(myUrl)
        response = request.GetResponse()

        Dim sr As StreamReader = New StreamReader(response.GetResponseStream())

        Dim txt As String = sr.ReadToEnd()
 
Non-email

Getting back to the original question, how would you do this without using email/hosting a text file on the web...?

If you just wanted to pass the ".text" from a textbox in a vb app on one pc into a textbox in another vb app on another pc somewhere on the LAN?
(A LAN that doesn't have internet access?....)

BEEN TRYING TO FIND THIS CODE FOR TWO DAYS AND IT IS KILLING ME! you'd think it'd be simple, since on a single ap it's a sinch, you can just:

VB.NET:
textbox2.text = textbox1.text

however when textbox 2 is on a different pc/program it all becomes much more difficult for a newb like me !.... are "sockets" what I should be researching/learning? OR (ideally) is there a simple line of code to do this like the one above??? (e.g maybe something like the line below)

VB.NET:
\\PC2.appVB_AP2.textbox2.text = me.textbox1.text
 
funluvincrim:

Assuming you're talking about two VB.NET windows apps, the easiest way to do what you're describing would probably be to write the Windows app you're interested in getting the value from with a socket/listener on some port, and then have your client app know to contact that IP address/socket with whatever command to retrieve the value.

I don't think you'll be able to remotely attach to the program any other way, since it's physically running on memory that the first computer can't address.

If the two apps were running on the same computer, you could probably use some fancy Reflection to get ahold of whatever values you wanted from it.
 
Thank you very much Jcortrig and JohnH... after some delving around into your socket solution I have been able to do exactly that!
for what I needed to do is fine, as i can now trigger videos on various pc's by sending text commands through a socket to all pc's and the commands can state which video to play on which pc etc.
Thanks for the gateway to the solution!!

One further thing though, the is fine for my current purposes, but it would be nice for a future application to send a command from a 'server' to all the client pc's on a LAN which will trigger a local video to play (so far so good).... However, when I do this currently there is a slight delay over the network between each of the clients so the videos all start, but are 'staggered' as apposed to being "frame synched"....

Anybody know how to get around this? I'm thinking maybe use an SNTP to synch all of the clients system clock's, and then send commands to the effect of 'play video A at time stamp 12:03:01' for example, but i'd imagine even this will still leave the videos slightly out of synch due to processing times etc....

It must be possible to fully synch (frame accurate) videos over a LAN, because programs such as DATATON's "Watchout" do this, trouble is they cost thousands of pounds and this isnt for a commercial purpose so I don't have any budget! If anybody could give me a start point/any advice to work towards making this in .net it'd be much appreciated!

Thanks,
Alastair
 
Getting many computers to do anything all together, synced-together is a pretty difficult problem to solve. You'll be dealing with potentially computers that are faster/slower than one another for whatever reason, additionally when you issue the command, one computer might be busy doing something (running a virus scan for instance) and not be able to devote as much processor time to it, etc.

Your idea about syncing all the computers to a time server and saying "do this at 13:01:01" is probably about as close as you can get, without some extremely heavy duty work/expense.

I suppose that the Dataton program (which I'm not familiar with) listens to a video broadcast stream, much the same as "internet radio" functions, only with video. In that regard, the clients have to deal with the content as they get it.

I've got no clue how to even begin doing that though, hah.
 
Thank you for your response Jcortrig,

Dataton Watchout dooes not stream, it basically has a server and several display machines on a LAN, the server sends commands that play video on the display machines which are stored locally on those display machines... Works over tcp/ip and this is essentially what I want to achieve...

Earlier I built a program which synchs all the system times of all pc's on the LAN, and then the server broadcasts commands to "cue" a local video on every client on the LAN (opens, pauses then rewinds video to the start), and then play at a specific timestamp (i.e: 1 second later). This "cueing" means its less dependant on the differnt pc's speeds at opening and running the file, as its already open, just has to unpause to play the file.

The "cueing", combined with keeping my application at the forefront of the process tree to avoid background "resource sucking" and running this all on identical, "process stripped", clean, ghosted pc's is giving me pretty good results; nigh on perfect video synching...

But not perfect enough!!! it's not "frame accurate" and I need it to be as i'm intending to play differnt parts of the same video on differnt pc's/screens. (before anyone says "use a multihead graphics card" - i want to do LOTS of them and also have full interactive control using vb controls.

Think where i'm currently at is the closest I can possibly get using WindowsMediaPlayer in vb, I Need to be able to "frame" synchronise the videos on differnt pc's somehow....

Grrrr this is really irritating! Can anyone help! / suggest other programs/languages etc. that can do this?

Thanks,
ALi
:(
 
Back
Top