Jump to content

Tcp Server/Client not working when used as a service


amfony
 Share

Recommended Posts

hey gang,

You may rember my post from a lil back about turning off monitors concurrently.

http://www.autoitscript.com/forum/index.ph...c=32374&hl=

I have a wonderful working solution now thanks to all the helpful posts, now i want to take it to the next step and have this tcp client run as service. to be able to achieve things when no one is logged on, also to avoid closing the process (with a system start IE cant be stopped).

I have succesfully used this procedure to create a custom screenCapture service on a local computer (cant find it at the mo, but was from this forum.)

- get instsrv.exe and srvany.exe

- use both files to install empty service

- regedit to create parameter key, and application string value - with the value being my compiled script.

Now i followed the exsact same procedure to use my compiled tcp client as a service, which works with out giving me errors, but actually DOING what it should, it doesnt. IE Shutdown monitors. Infact the tcp client as a service wont do much even though the .EXE is running in process window. If i run this tcpclient manually it works.

I tried playing with "Allow to interact with destop" and "Logon as ..." but still no avail.

Am i trying to do something which cant be done? Or am i falting in an area.

If you require to look at my code just ask, i didnt post it because i know the code is good and not the issue.

Thanks guys and gals.

Link to comment
Share on other sites

hey gang,

You may rember my post from a lil back about turning off monitors concurrently.

http://www.autoitscript.com/forum/index.ph...c=32374&hl=

I have a wonderful working solution now thanks to all the helpful posts, now i want to take it to the next step and have this tcp client run as service. to be able to achieve things when no one is logged on, also to avoid closing the process (with a system start IE cant be stopped).

I have succesfully used this procedure to create a custom screenCapture service on a local computer (cant find it at the mo, but was from this forum.)

- get instsrv.exe and srvany.exe

- use both files to install empty service

- regedit to create parameter key, and application string value - with the value being my compiled script.

Now i followed the exsact same procedure to use my compiled tcp client as a service, which works with out giving me errors, but actually DOING what it should, it doesnt. IE Shutdown monitors. Infact the tcp client as a service wont do much even though the .EXE is running in process window. If i run this tcpclient manually it works.

I tried playing with "Allow to interact with destop" and "Logon as ..." but still no avail.

Am i trying to do something which cant be done? Or am i falting in an area.

If you require to look at my code just ask, i didnt post it because i know the code is good and not the issue.

Thanks guys and gals.

yeah.. but like you know we are "Supporters" not "Script Writers".

first try yourself.. then ask for support so a CODE would be appreciated.

Thnk

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

@AceLoc -

In 2 seperate threads you have told me to go and code and come back with results. In both situations, coding was not the problem, as is clearly stated in my posts. In both posts you have contributed nothing. Please, if you see a thread with my name on it, do not reply to it.

@Everyone Else - If you feel that my asking for help is in anyway incorrect, or offensive (?), please let me know and i will ammend my AutoIT forum ettiquete.

I restate, my code is not the problem. It functions correctly when client is run manually, but does not when used as a service.

Thank you.

Link to comment
Share on other sites

Have you thought about just writing a remote registry script to change the power settings?

Or from a batch file Rundll32.exe to powrprof.dll i think. you can google it and find the params to set the monitor power off delay.

If you can do this then just be sure to make a call to

C:\windows\system32\RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters

or the registry settings will not take effect until you relog.

Link to comment
Share on other sites

Yeh, thats a viable option. Thanks Nezioc. However ive grown my client to achieve more then just poweroff monitors so i need the service to function as a whole. (I should say, i need my client to function as a service in its entireity)

Has anyone used their tcp/client as a service?

Link to comment
Share on other sites

Why don't you try having the clients as services but the server as a normal process?

Or, maybe instead of a service, and autostartup kind of thing? (Only works when someone is logged on.)

I've ran out of ideas... maybe if you can guess what is going wrong then we can try and fix it.

#)

Link to comment
Share on other sites

Why don't you try having the clients as services but the server as a normal process?

Or, maybe instead of a service, and autostartup kind of thing? (Only works when someone is logged on.)

I've ran out of ideas... maybe if you can guess what is going wrong then we can try and fix it.

#)

I have a few questions about your service:

Are you running it as Local System?

Do you have any logging capabilities built into your script?

You mention trying a log on as . . . How exactly did you go about it?

My suggestion would be to do a manual run of the Application as the Local System Account.

you can do so by downloading PSEXEC from sysinternals and then running the following command line:

PSEXEC -I -S CMD

when your Dos shell comes up just run your app that way.

hope that helps.

-Blademonkey

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Link to comment
Share on other sites

Why don't you try having the clients as services but the server as a normal process?

Or, maybe instead of a service, and autostartup kind of thing? (Only works when someone is logged on.)

Yeh nwfu, at the moment im running it with the registry key HKLM\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion\RUN which is what i want. However id like to extend the functionality to pre-logon environemnt. Its me being greedy i guess, but id like to see it happening - or atleast find out why im having problems. Thanks for the input. Also The plan is to have that model, of clients running as services and server running as a manual process/program, infact thats the exsact scenario i have my problem with now.

I have a few questions about your service:

Are you running it as Local System?

Do you have any logging capabilities built into your script?

You mention trying a log on as . . . How exactly did you go about it?

Mr.Monkey -

- Yes(but refer to number 3 answer)

- No , i will put some in - what should i be looking for to log?

- Via services.msc/Log on as ../then selected a network user IE admin (only for testing purposes)

I was thinking that local system didnt have network/network card access/usage/privleges but running it as a network user didnt work either.

I've ran out of ideas... maybe if you can guess what is going wrong then we can try and fix it.

Well the obvious-ness is the fact it works as a manually run program (both client and server), but not with the cleint as a service. Therefore some aspect of running as service is afecting the connection. But honestly, i got nothing, i dony know why im not succedding.

Thanks alot for the interst though! I will try your psexec line and return with results.

Edited by amfony
Link to comment
Share on other sites

sorry to bump - im hoping this topic would gather some interest with other remote commanders out there.

I think the person im looking for is the guy who made the TCP Made Easy(amongst other goodies). AutoITSmith where for art thou?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...