Solved

Restarting  a remote machine

Posted on 1998-09-21
5
280 Views
Last Modified: 2013-11-13
How can I restart a remote machine, which is running windows-95.It is in the same workgroup.I do not want to use pc-anywhere.can you tell me a program which I can write to restart the remote machine.

     The problem is we need to access the remote machine through pc-anywhere but some times ,the employees of that company shut off pc-anywhere.At this point of time the machine is on but i cannot access the machine through pc-anywhere.So,If i reboot the system,pc-anywhere loads up as it is in the start up group.
0
Comment
Question by:zeus_akkali
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
sunj earned 50 total points
ID: 1436003
Hi,
 One simple way I can think of is to write a server program as well as a client program. The server will be running on the remote machine, listening at some predefined port. If a connection comes and regarded as a valid request, the server program can send appropriate windows message to restart the windows(Actually, in your case it might be more straightforward to ask your server to invoke the pc-anywhere program). You can put the server program to the startup group and since no window is needed for the server, it is invisible and the employees there will not be able to terminate the server simply(unless they get the process list and kill the server process).  
Let me know if you have problems writing client/server winsock programs and I may put some source code here.

sunj
0
 
LVL 1

Author Comment

by:zeus_akkali
ID: 1436004
I like the Idea given by you and would appreciate if you ge me a head on start with with winsock programming.Iam new to winsock.

Thank You,
Zeus
0
 
LVL 14

Expert Comment

by:waty
ID: 1436005
If you want, I have code to shutdown directly NT workstation across the network without any client, winsock..., but it doesn't work under Win 95
0
 
LVL 1

Expert Comment

by:sunj
ID: 1436006
Hi, zeus_akkali:

  Winsock programming wasn't an easy task. However, with Visual Basic and Microsoft Winsock Control, a lot of details are hidden and programming is much easier. First of all, add a Winsock Control to your form. To create a server, you have to specify the LocalPort property. That is the port that your server will be listening at(and this is port that your client should connect to). Then, in your form's Load method, you can start the server by calling Winsock1.Listen method. Now if your client tries to connect to the server, there will be a ConnectionRequest event which means your Winsock1_ConnectionRequest will be called. Usually here we will perform some check and accept the connection and send some data back to the client. However, in your case it is much easier as we do not have to feed back anything to the client. What you can do in Winsock1_ConnectionRequest() is simply invoking the PCanywhere program(by Shell() or whatever).  
  To make connection to the server, you can write your own client using winsock control. But again, you can make life easier by using the telnet's functionality. You can do this to send a connection request to server:

  telnet 123.456.789.0 7777

Here we assume your server's ip is 123.456.789.0 and the server is listening at port 7777.

  Below is some sample code about the server. You can see it is very short. :) Assume you have a Winsock control "Winsock1" on your form and here the server simply invokes windows' calculator program when there is a incoming connection request.(try telnet!)  

Private Sub Form_Load()
' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Winsock1.Listen
End Sub

Private Sub Form_Unload(Cancel As Integer)
Winsock1.Close
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1)    ' Run Calculator.
End Sub


Let me know.

sunj
0
 
LVL 1

Author Comment

by:zeus_akkali
ID: 1436007
Thank You Sunj for your help.I think this answers my questions.Thank again.

Zeus
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now