|
From: ender w. <end...@ya...> - 2003-09-29 20:51:43
|
In short: I wrote a java program that listens to a Server Socket and when receives a message on the socket it prints it on the screen in a Frame. The program works fine when I test it in the Wrapper console. Next, I tried adding a shortcut of the .bat file frok the bin dir to the my startup folder. When I log on the wrapper console appears, and it says: ////////////////////////////////////////// wrapper | --> Wrapper Started as Console wrapper | Launching a JVM... jvm 1 | Wrapper (Version 3.0.5) jvm 1 | //////////////////////////////////////// but my program does not start. If I look at the log I actually see that there is no entry for the current time, ie for the user logon time. Basically I would like to know if I am using the wrapper improperly, and if I am, how do I make my program start automatically short of making an exe and placing it in the startup? --- Earnie Dyke <ed...@vr...> wrote: > You should be able to start your application when > the user logs on by adding > it to the users startup folder in windows. You > should be able to identify > the user via the system properties. Should work the > way you want it to. > > Earnie! > > -----Original Message----- > From: ender wiggin [mailto:end...@ya...] > Sent: Friday, September 26, 2003 9:51 AM > To: wra...@li... > Subject: Re: [Wrapper-user] Sockets and desktop > > > Hi. > > Thanks for the replay.I wonder if you could point me > in the right direction.Quoting: > "You are going to need to have an > > application running in the User space > > which is launched when the user logs in. This > > component could then communicate to > > the service using any of a number of methods" > It would be very nice to write an small program > that > gets launched AUTOMATICALLY at user logon.(then this > application will communicate with the service that > collects messages and tell it to print the messages > to > screen to screen)Is there a way(In Java)? > > Alex > > > > --- Leif Mortenson <le...@ta...> wrote: > > Alex, > > I am not sure that your assumption about not > > being able to use Sockets > > and a GUI in the same service is correct. The > > TestWrapper example > > that is shipped with version 3.0.5 of the Wrapper > > does both and works > > just fine. > > > > Edit wrapper.conf and set the following > > wrapper.ntservice.interactive=true > > at the bottom of the file. Then install the > > TestWrapper as a service > > and start > > it. > > InstallTestWrapper-NT.bat > > net start testwrapper > > > > Now telnet to the machine on port 9999. When > it > > connects, type 'R' > > Must > > be upper case. The Wrapper will promptly restart > > the JVM.. All works fine > > both using localhost and from a remote machine. > > > > The problems you are having with your users is > a > > little more > > difficult. Unless you > > specify an account in the wrapper.conf file, NT > > services will by default > > always run > > as the SYSTEM user. This is also true for their > > child processes (Java > > in this case) > > So no matter how many times you check, your user > is > > always going to be > > SYSTEM. You are going to need to have an > > application running in the > > User space > > which is launched when the user logs in. This > > component could then > > communicate to > > the service using any of a number of methods. > > > > There is not any way that I am aware of for an > > NT service to tell > > when a user logs > > in to the system. It sounds like it should be > > possible, but not with > > the current Wrapper. > > > > Telling when the user logs out is easy. > Windows > > sends a logout > > signal to all processes > > when any user logs out. The Wrapper intercepts > this > > and prevents the > > Wrapper and its > > JVM from exiting. The WrapperSimpleApp and > > WrapperStartStopApp classes > > do not > > provide a way for your java app to see this > signal, > > but you can see it > > if you use method > > 3, by implementing the WrapperListener interface > > directly. The > > listener's controlEvent > > method is called whenever any system signals are > > received. This gives > > the app the > > opportunity to respond. > > > > I posted a couple of feature requests around > > this so I remember to > > look into ways > > of making it possible to tell when and who logs > in. > > > http://sourceforge.net/tracker/index.php?func=detail&aid=812174&group_id=394 > 28&atid=425190 > > > http://sourceforge.net/tracker/index.php?func=detail&aid=812175&group_id=394 > 28&atid=425190 > > > > Cheers, > > Leif > > > > > > > > ender wiggin wrote: > > > > >Hello. > > > > > >First some details: > > >I am working on a project involving an instant > one > > way > > >messaging on windows. Basically I am writing a > > >service(SocketService) that connects with a > server > > >through a socket and writes to file/(some > > repository) > > >the messages it receives. Another service( > > >DesktopMessageService) reads from the files the > > >messages and if it finds a new message for the > > CURRENT > > >user it will open a frame and show it on the > > screen. > > >The reason I use two services instead of one is > > >because I read that a service either does > neworking > > or > > >it accesses the desktop or console. > > > The SocketService performs well, it does indeed > > read > > >from a socket(ServerSocket) and when contacted > > there > > >are messages it does store them on file. > > > > > >The problems arise with the > DesktopMessageService.I > > >have yet to find a way to detect the current > > >user.Basically when the pc is booted the > > >DesktopMesssage starts ,tries to detect the > current > > >user and print to screen a message.The problem is > > that > > > > > >I cannot decect when a user loggs on to the > > machine. > > >The current user for the DesktopService is still > > >System.So if I want to print a message Hi + > > >System.getProperty("user.name") , even if there > is > > a > > >user logged on it still prints Hi System , not Hi > > >"Current User Name".Im also tried to restart the > > JVm > > >periodically but the curent user is still System. > > >By the way the service works fine when tested in > a > > >console . > > > > > >So my questions are, Is there a way to detect > when > > a > > >user loggs on and get his name? > > >Also, is there a way to detect when a users logs > > off? > > > > > >Thanks, Alex > > > > > > > > > > > > > > > > > === message truncated === ===== __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |