Hi, Are you running the SocketServer in another JVM (Runtime.exec())? Static variables are only shared if they're in the same JVM. You need to add some kind of shutdown handler, usually I open another port for UDP and listen for packets like "(user)\t(password)" and checking for the ip they come from (usually only 127.0.0.1). Alternatively, make SocketServer create a file (something like c:\temp\socketserver.run or /tmp/socketserver.run), then check if this file still exists, if it's not then shutdown.
Greetings, deacon Marcus > -----Original Message----- > From: noriaki ishihara [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 15, 2001 6:22 PM > To: [EMAIL PROTECTED] > Subject: Close SocketServer > > > Hi. > I have 2 questinos. > > I have a html page that has a button "Start Log > Server" which calls a servlet to kick off > SocketServer. This SocketServer logs to a specified > file on the server. Now, what I want is to have > another button on the html page "shut down Log Server" > that will shut down the SocketServer. When a user hit > this button, I would like SocketServer to go down > exactly like hitting Ctl-C when running SocketServer > for console appender from command line. How can I > kill the SocketServer? > > 2nd question is actually same as 1st one, but my > attempt failed to bring socketServer down so... > > I made a ServerSocket variable as static class > variable, and added a new method "CloseSocket()" to > close the SocketServer. But, when a client program > execute such a static method, ServerSocket variable is > null and throws an exception... (in the > SocketServer's main method, I have a check on > serverSocket variable and if serverSocket is closed, > get out the SocketServer app.) > > So.. (this one is more of a psudo-code) > > class SocketServer > { > static ServerSocket serverSocket; > : > static void main(args[]) > { > // start the socket server and initialize > serverSocket > } > static CloseSocket() > { > serverSocket.close(); > } > } > > class SocketClient > { > static void main(args[]) > { > SocketServer.CloseSocket() // serverSocket is > null.. > } > } > > I am using 1.1.3 of log4j on win 2000. > > Thanks!!! > > > > > __________________________________________________ > Do You Yahoo!? > Make a great connection at Yahoo! Personals. > http://personals.yahoo.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]