| | |
Makeing program to watch for server crash?
Please support our VB.NET advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
Hello i have been trying to make a program that should restart my server if it crashes. Just some few problems... it won't work.
My problem is that when it notices the program runs, it won't do the process again, and just stop watching for the server crash. Please tell me a way to make it repeat
I tryet do a Do...Loop but i don't seem to do it right.
VB.NET Syntax (Toggle Plain Text)
Imports System.Net.Sockets Imports System.Text Module Module1 Sub Main() Console.Title = "Shifty Server Keeper" Dim clientSocket As New System.Net.Sockets.TcpClient() While clientSocket.Connected = False Try clientSocket.Connect("127.0.0.1", 27015) Console.WriteLine("Running") Catch ex As Exception Console.WriteLine("Crashed") Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("ssrcds") For Each p As Process In pProcess p.Kill() Next System.Diagnostics.Process.Start("C:\....") End Try End While While clientSocket.Connected = True End While End Sub End Module
My problem is that when it notices the program runs, it won't do the process again, and just stop watching for the server crash. Please tell me a way to make it repeat

I tryet do a Do...Loop but i don't seem to do it right.
Last edited by Qvintus; Nov 8th, 2009 at 8:09 am.
•
•
Join Date: Sep 2009
Posts: 321
Reputation:
Solved Threads: 45
0
#2 Nov 9th, 2009
Running code in a constant/endless loop would be exactly that, your program freezing up the pc because its constantly running something over & over to search your server's status.
If keeping in a console app, I would set it up so that the windows task scheduler runs the process once at interval set times or create it as a windows process. Another option is to create a windows app on a timer basis but again, this would be a program constantly running in the background.
If keeping in a console app, I would set it up so that the windows task scheduler runs the process once at interval set times or create it as a windows process. Another option is to create a windows app on a timer basis but again, this would be a program constantly running in the background.
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#3 Nov 10th, 2009
So you have any eksample code i could look at to make it better or?
yea... I know the app. Timer would just freeze the program it self. while if i run it in cmd app. it works okay. The problem is just how should i put it up to get it to work?
Should i make a public function to look for connection to server. That returns true every time the program can't connect to the server, or? yea any kind of eksample that could help me to a final working program.
yea... I know the app. Timer would just freeze the program it self. while if i run it in cmd app. it works okay. The problem is just how should i put it up to get it to work?
Should i make a public function to look for connection to server. That returns true every time the program can't connect to the server, or? yea any kind of eksample that could help me to a final working program.
![]() |
Similar Threads
- helloworld program error in linux server (Java)
- Web client enable C++ program on server (C++)
- creating an instant messenger program in java (Java)
- Pascal Average Program Question (Pascal and Delphi)
- Need help debugging program (Java)
- Antivirus program for my 2003 server (Windows NT / 2000 / XP)
- I've tried everything...setting font of selected text (Java)
- wget? (Mac Software)
- problem with e-mail server (Networking Hardware Configuration)
Other Threads in the VB.NET Forum
- Previous Thread: The publisher could not be verified...
- Next Thread: Viewing System information
Views: 291 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
"crystal .net .net2005 2008 access add application array assignment basic box button buttons center class click code combo convert cpu data database datagrid datagridview design designer dissertation dissertations dissertationthesis dosconsolevb.net editvb.net employees error excel exists firewall function image images isnumericfuntioncall listview login map math memory mobile module msaccess mssqlbackend mysql navigate net opacity page pan picturebox port print printing printpreview problem record refresh regex reports" reuse right-to-left save savedialog search serial socket sorting sql sqldatbase storedprocedure string structures studio temp textbox timer txttoxmlconverter upload useraccounts usercontol usercontrol vb vb.net vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet vista visual visualbasic visualbasic.net visualstudio2008 web wpf xml





