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 chatserver;
16:
17: /*
18: Server Messages
19: ------------------
20: Id format
21: user1 <- user in any room
22: user1@home <- user in room
23: @home <- to room
24:
25: {user.info:<id>} <type> <- Gives info about users
26: Where <type> can be
27: LoggedIn
28: LoggedOut
29: {user.msg:<fromid>:<toid>} <-Message from user
30: {user.list} <id> <- system is giving list of users in room
31:
32:
33: {system.error} <type> <- Error at server
34: Where <type> can be
35: MessageNotSent
36: BadCommand
37: AuthFailed
38: BadParam
39: {system.debug} <- Debug info from server
40: {system.msg} <- Message from server
41: {system.help} <- Help from server
42: {system.data} <- Server is waiting for data
43: {system.ok} <- Success
44:
45: */
46:
47: import org.quickserver.net.*;
48: import org.quickserver.net.server.*;
49:
50: import java.io.*;
51: import java.util.logging.*;
52: import org.quickserver.util.logging.*;
53:
54: /**
55: * Main class of ChatServer
56: * Demonstrates how to find another client connected and
57: * send String to it.
58: * @author Akshathkumar Shetty
59: */
60: public class ChatServer {
61: public static String VER = "2.0";
62:
63: public static void main(String s[]) {
64: QuickServer chatServer = new QuickServer();
65:
66: String confFile = "conf" + File.separator + "ChatServer.xml";
67: Object config[] = new Object[] { confFile };
68:
69: try {
70: if (chatServer.initService(config) == true) {
71: chatServer.startServer();
72: chatServer.startQSAdminServer();
73: }
74: } catch (AppException e) {
75: System.out.println("Error in server : " + e);
76: e.printStackTrace();
77: }
78: }
79: }
|