Solved

Restarting  a remote machine

Posted on 1998-09-21
5
279 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank You Sunj for your help.I think this answers my questions.Thank again.

Zeus
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

771 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

11 Experts available now in Live!

Get 1:1 Help Now