Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Delphi 2005 Personal and Indy 10.0.75: Indy don't work!!!
| Subject: | Re: Delphi 2005 Personal and Indy 10.0.75: Indy don't work!!! |
| Posted by: | "Jamie Dale" (j.da..@turboz.net) |
| Date: | Fri, 2 Jun 2006 23:41:14 |
>> When I run it on the other machine, it downloads the xml file of the
>> hosts in my account, and then stops. It doesn't check the IP address
>> anymore (despite the timer being enabled).
>
> You shouldn't be using a timer in a service to begin with. But that is a
> side issue.
Check out the online service tutorials - they nearly all use a timer to log
the diskspace every 5 mins etc etc.
Whats wrong with using a timer anyway? (just for curiousitys sake)
>You haven't provided any details about where the stoppage is
> actually occuring in the code.
Ok, I'll post my code here and you can have a look - Don't laugh though cos
it's not the neatest but it works.
> There are any number of reasons why a
> service could stop running, and most of them have nothing to do with Indy
> or
> Delphi at all.
And there are even fewer ways of debugging services :*(
> Without seeing your actual code, or any logs from the
> service, there is no way to diagnose that kind of problem.
If you wait, it will come..
Logging is buggered for some reason...
>> It doesn't run through the list of hosts and compare IPs. It doesn't
>> even maintain the log properly either.
>
> Sounds like you probably deadlocked your service, or maybe crashed its
> thread so it was termiunated prematurely. But again, without details,
> there
> is no way to know.
Yeah, init just. I got the thing on my PC and I can't determine the problem
so I don't hold out much hope for you really.... wanna come round my place
and take a look?
>> With regards to the GUI thing, I'm aware of that however I set the
>> program as interactive as I wanted it to have a GUI interface so that I
>> could update it etc.
>
> Services are not supossed to have GUIs to begin with.
True, but then look at no-ip.com - they're dynamic DNS updater can be run as
a service with a GUI so I figured, why not?
Has been very reliable until recently..
> They are meant to be background tasks.
True, I'll give you 2 point for that ;)
> Even an Interactive Service can have problems with GUI
> (especially when the VCL is used for the GUI). If the user logs out, an
> Interactive service can't run properly anymore (and the VCL can crash).
It's run under the system account. Dunno about NT or Server 2003, but on XP
it runs pretty well. Though the GUI only shows up with whoever has session 0
in console - That can be a nuisance..
> The best way to handle service GUIs is to move the GUI to a separate
> non-service
> application that is run while the user is logged in and communicates with
> the service when needed.
I did experiment with passing data from one application to another but it
didn't always seem to be successful (courtesy of torry.net). I kinda find it
easier to use TIdTCPClient/Server these days but then that has its
pitfalls...
> This also allows the service to run while no user
> is logged in at all (which is what services are supposed to be able to do
> in
> the first place).
And under the System account they can. Talker.exe (which I told you about
previously) can speak with no user logged on at all. I gotta say, it took my
mother by surprise a while back ;)
>
>> Thing is, I needed it to run whether I was logged onto the machine
>> or not
>
> Then you can't put the GUI into the service directly.
But Talker.exe has worked faultlessly for over 6 months - almost 7!!! -
Until now!
>> so a system service seemed like the logical answer.
>
> It is.
Yay! we agree!
>> Oddly enough I have another service which is installed too: Talker.exe.
>> It basically uses a TCP server and Microsoft speech engine. When you
>> connect via TCP it will speak whatever text you send to it. Guess
> what?.....
>> Yep, also not working correctly
>
> Again, the only way installing Delphi could have effected that is if
> Delphi
> installed a library that the service depends on. That is very unlikely,
> though.
I know - it's really frustrating at my end. I have tried everything I can
think of including system restore - rolling back to pre-delophi2005 - It
made no difference!!!
>> Compiled both on my main PC with D6 installed using D6 as the compiler.
>> Yes I tried compiling Talker.exe on that machine
>
> Do ou have runtime packages enabled or disabled when compiling?
The "Build with runtime packages" box is NOT checked. IE everything is
compiled into the .exe with no external dependencies.
>> My delphi is configured to compile all required packages into the main
> .exe.
>> Therefore it is not dependant on anything
>
> Then there is no way that installing Delphi 2005 should have effected
> those
> projects at runtime.
I know but there seems to be no other cause at all. It's all very strange
how hell breaks loose when I installed D2005. Previously all was fine but
now for some really weird reason it's up n down more times than a whores
knickers...
> Something else has to be happening. But again,
> without debugging details, there isno way to know what is actually
> happening.
And debugging a running service is not sometime I really wanna get into.
>> other than M$'s Agent (Yes it's installed on that machine).
>
> If you are referring to MSAgent (http://www.microsoft.com/msagent) then
> you
> can't use that in a service.
I have successfully used it in a service for the last 6 months with no
faults at all. Though I imported the ActiveX control and used the DirectSS
component on my form. Don't know if that makes a difference or not but I can
confirm it DOES work when used in conjunction with a system service. It
works, runs regardless of a user being logged on or not and has never
faulted until I installed D2005. I have witnesses. Think about it logically,
if a service runs under the system account then it is a running program
right? If a running program can access files and create logs etc, then it
makes sense that it can interact with other programs, services, ActiveX
controls, etc etc etc. My theory worked and the finished project worked for
6 months with no fault. If you like I will send you the archived source for
the program - who knows you may find it interesting.
>> But if you use uCiaService component and set the service as
>> interactive it can ;)
>
> Not reliably, it can't.
I know you mean well but I've got first hand experience using it.
> The GUI aspects of the VCL are not designed for use
> in services. If you are not careful, you can mess up the service at
> runtime, if not the entire machine.
Yes but if you set the forms visible to false, (if it's running as a
service) then you can avoid all the complexities of GUI's trying to show up
while no user is logged on etc etc. Remember if the form was visible hell
would break loose which is why I only set it visible if it is NOT a service.
There is also a menu item so that if a user is logged on, they see a tray
icon. Click the menu item and the form will show up but of course this is
only available if someone is logged on..
> For example, VCL GUI components uses
> global resouces that are not preserved during a user logout.
Well thats real advanced stuff. I'm a low-level coder and if it works for me
I'm happy ;)
> When the user
> logs back in, the previous resources are gone, and the components fail to
> work properly.
Not had that happen yet to be honest. Maybe there are some differences with
XP & NT?
Either way it runs under the system account so effectively, the user never
logs off but is always logged on. That makes sense?
>> Do they do D2006 aswell? - I'd really like to give that a chance instead
>> of downloading 2005 again..
>
> The free trail is 2006, not 2005. My mistake.
Lol, ok I'll give it a try - thanks pal
Jamie