Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 14 15 package dateserver; 16 17 import org.quickserver.net.*; 18 import org.quickserver.net.server.*; 19 20 import java.io.*; 21 import java.util.logging.*; 22 23 26 public class DateServer { 27 public static String VER = "1.0"; 28 public static void main(String s[]) { 29 String cmdHandle = "dateserver.CommandHandler"; 30 String objHandle = "dateserver.ObjectHandler"; 31 String auth = null; 32 33 QuickServer myServer = new QuickServer(cmdHandle); 34 myServer.setClientAuthenticationHandler(auth); 35 myServer.setPort(125); 36 myServer.setName("Date Server v " + VER); 37 if(getQuickServerVersion() >= 1.2) { 38 System.out.println("Using 1.2 feature"); 39 myServer.setClientObjectHandler(objHandle); 40 41 myServer.setConsoleLoggingToMicro(); 43 } 44 45 Logger logger = null; 47 FileHandler txtLog = null; 48 File log = new File("./log/"); 49 if(!log.canRead()) 50 log.mkdir(); 51 try { 52 logger = Logger.getLogger(""); 53 logger.setLevel(Level.FINEST); 54 55 logger = Logger.getLogger("dateserver"); 56 logger.setLevel(Level.FINEST); 57 txtLog = new FileHandler("log/DateServer.txt"); 58 txtLog.setFormatter(new org.quickserver.util.logging.MicroFormatter()); 60 logger.addHandler(txtLog); 61 62 myServer.setAppLogger(logger); 64 myServer.setConsoleLoggingFormatter( 66 "org.quickserver.util.logging.SimpleTextFormatter"); 67 myServer.setConsoleLoggingLevel(Level.INFO); 68 } catch(Exception e){ 69 System.err.println("Could not create xmlLog FileHandler : "+e); 70 } 71 73 try { 74 myServer.startServer(); 75 76 myServer.getQSAdminServer().setShellEnable(true); 77 myServer.startQSAdminServer(); 78 } catch(AppException e){ 79 System.out.println("Error in server : "+e); 80 e.printStackTrace(); 81 } 82 } 83 84 public static float getQuickServerVersion() { 85 return QuickServer.getVersionNo(); 86 } 87 } 88 89 90
| Popular Tags
|