01: /*
02: * This file is part of the QuickServer library
03: * Copyright (C) 2003-2005 QuickServer.org
04: *
05: * Use, modification, copying and distribution of this software is subject to
06: * the terms and conditions of the GNU Lesser General Public License.
07: * You should have received a copy of the GNU LGP License along with this
08: * library; if not, you can download a copy from <http://www.quickserver.org/>.
09: *
10: * For questions, suggestions, bug-reports, enhancement-requests etc.
11: * visit http://www.quickserver.org
12: *
13: */
14:
15: package cmdserver;
16:
17: import org.quickserver.net.*;
18: import org.quickserver.net.server.*;
19:
20: import java.io.*;
21: import java.util.logging.*;
22:
23: public class CmdServer {
24: public static String VER = "1.2";
25:
26: public static void main(String s[]) {
27: Logger logger = Logger.getLogger("");
28: logger.setLevel(Level.FINEST);
29:
30: String cmdHandle = "cmdserver.CmdCommandHandler";
31: String data = "cmdserver.CmdData";
32: String auth = null;
33:
34: QuickServer cmdServer = new QuickServer(cmdHandle);
35: cmdServer.setClientAuthenticationHandler(auth);
36: cmdServer.setClientData(data);
37: cmdServer.setPort(23);
38: cmdServer.setName("Cmd Server v " + VER);
39:
40: //check if cmd args was passed
41: if (s.length > 0) {
42: Object[] store = new Object[] { s[0] };
43: cmdServer.setStoreObjects(store);
44: }
45:
46: //start admin server with default auth
47: QuickServer adminServer = cmdServer.getQSAdminServer()
48: .getServer();
49: adminServer
50: .setServerBanner("QSAdminServer Started on port : " + 124);
51: adminServer.setCommunicationLogging(false);
52: try {
53: cmdServer.startServer();
54: cmdServer.startQSAdminServer(124, null);
55: } catch (AppException e) {
56: System.out.println("Error in server : " + e);
57: e.printStackTrace();
58: }
59: }
60: }
|