Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,008 members, 7,821,540 topics. Date: Wednesday, 08 May 2024 at 02:38 PM

Ideas For Problem With Chat Server Application! - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Ideas For Problem With Chat Server Application! (1249 Views)

My Problem With Nigeria Programers. / Problem With Bufferedinputstream Read Blocking Issue In Java / I Have A Problem With Raise Event In C# (2) (3) (4)

(1) (Reply) (Go Down)

Ideas For Problem With Chat Server Application! by davidt(m): 9:09am On Jul 22, 2009
Hey programmers on nairaland!

I developed a chat application with an attendant chat server. Everything is working fine. The issue now is the fact that whenever the chat server goes down (for instance, the server system shuts down as a result of power failure or some other problem), by the time the server system come back on, the chat server would have to be restarted manually.

I believe (and I know) it is more appropriate for the chat server application to restart itself when the computer comes back on (and of course regardless of who is logged in and of course, even before anyone logs in). I have a batch file that executes the chat server. My attempt was to create a windows service that start automatically and runs this batch file using a Network Service account on the server system. Although, I'm having a hard time with this (temporarily), I would love to ask if there are any alternatives to using a windows service. Suggestions are highly appreciated.
Re: Ideas For Problem With Chat Server Application! by femu(m): 5:05pm On Jul 22, 2009
U can add the location of the primary executable to the registry or copy the batch file/executable to the Startup folder
Re: Ideas For Problem With Chat Server Application! by javabeasns: 7:15pm On Jul 22, 2009
I believe you created your windows service in Visual studio. I f you configure it to run under network service account, you can configure it not be stopable and in the services.msc (services console) you can also change the start mode to automatic and not manual.
Check if this work and holla back
thanks
Re: Ideas For Problem With Chat Server Application! by Nobody: 12:00am On Jul 23, 2009
Try out what java beans said. Meanwhile, if you wish to use the batch file to autostart it, you can add it to the registry like this:

Step 1:
open your run (logo key + R), or click on Start, then run (dunno your os)

Step 2:
Launch "regedit" from the run

Step 3: Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Step 4:
Create a New String Value there, and call it say "Chat Server"
Then double click and change the value to your batch file, make sure
it is in quotes like this:

"C:\Program Files\Chat Server\autostart.bat"

That way, the batch file can autostart with your pc.
Meanwhile, for a lik security, you can look for a simple utility to convert
that your batch file to executable .exe file.

To change the autostart option, you may lauch "msconfig" from the
start menu after you have added the registry entry. If you still have any
problems, please come back here.
Re: Ideas For Problem With Chat Server Application! by davidt(m): 8:47am On Jul 23, 2009
Nice ideas guys.

This is the scenario. This task must be easy to carry out by an average (ordinary) computer user.

@javabeasns
In the process of trying to achieve this, I have created windows services in a couple of languages. But let's talk about the Windows Service I created in VS2005. Now, this was what I did. I created a windows service and of course, ran it under the NetworkService account, made it . When the service is starting, it launches the necessary batch file. The issue here is that in a Windows service, user interaction is not typical. Therefore, my desire to enable the user select the location of the batch file or executable to run at boot-up (independent of user log-in), is made far-fetched. I was even thinking of using an xml file to set these parameters and then read this file before starting the service, but this voids the ease of use (for the average user) goal I'm trying to achieve. Therefore, I've kinda put the VS2005 service application approach on hold since user interaction cannot be achieved. Thanks javabeasns

@*dhtml
I've been considering registry hacks too. That is, I've been thinking about automating some registry entries (programmatically) for ease of use (even creating a registry script thingy would violate my ease of use goals). A quick question (sir)? Does making these registry entries enable the batch file execute itself even when a user is not logged-in yet?

@femu
Thanks for taking the time to respond and thanks for your idea.

You guys have always been helpful and that's just great.
Re: Ideas For Problem With Chat Server Application! by Nobody: 8:44pm On Jul 23, 2009
The registry entry will run as any user is being logged in. But if you are using windows vista with UAC on, we need to change the command slightly (i think we might have a glitch there).
Is there a way to start a service or program when a user is not logged in?
Re: Ideas For Problem With Chat Server Application! by candylips(m): 3:06pm On Jul 24, 2009
are u doing this for fun or for a customer ?
Re: Ideas For Problem With Chat Server Application! by davidt(m): 5:08pm On Jul 24, 2009
@*dhtml

A service that is set to automatic and runs under the Network Service or Local Service account should run even when no one is logged in.

@candylips
This whole thing is part of a product and is for the next version of the product in question. And of course, this application suite currently has customers.
Re: Ideas For Problem With Chat Server Application! by Nobody: 11:45pm On Jul 24, 2009
davidt:

@*dhtml

A service that is set to automatic and runs under the Network Service or Local Service account should run even when no one is logged in.

@candylips
This whole thing is part of a product and is for the next version of the product in question. And of course, this application suite currently has customers.

If you read my posts carefully, you will see that i was talking about autorun entries which are different from services, autorun entries do not run when no one is logged in - that was what i was saying.
Re: Ideas For Problem With Chat Server Application! by lojik(m): 12:33am On Jul 25, 2009
Therefore, my desire to enable the user select the location of the batch file or executable to run at boot-up (independent of user log-in), is made far-fetched.

Would this be at install time or run time?
If u want users to select the location of the batch file at install time, then u might consider coding your own simple installer.

If u want users to select the location of the batch file at run time and u want the service to run before login, and you want to enable user interaction after login, this is what i i did for an incoming sms server gateway i worked on:

The app runs as a service before login (as u've tried), after login another instance of the app is started from the start-up folder, this new instance sends a message to the service, the service checks the message and terminates. Now only one instance of the app is running and its ready for user input.

If no user logs in, the service continues running so no problems and if anyone logs in, they can see the gui and interact.

(1) (Reply)

How To Write Assembly Language For Microcontrollers / What Type of Pain (Problem) Are You Solving? / Backend Developer Needed For A Day's Job

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 23
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.