• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Restarting a remote machine

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
zeus_akkali
Asked:
zeus_akkali
  • 2
  • 2
1 Solution
 
sunjCommented:
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
 
zeus_akkaliAuthor Commented:
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
 
watyCommented:
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
 
sunjCommented:
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
 
zeus_akkaliAuthor Commented:
Thank You Sunj for your help.I think this answers my questions.Thank again.

Zeus
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now