NetDragons Football Posters | Queen Posters
Games | Free Web Hosting | DVD | Books | Shop | Posters
Google
Name
Password
Save Password?



[-]NetDragons.com
[-]Games
 | [-]24 Hour Games
 |  | [+]Nelzan
 |  | [+]Space Frag I
 |  | [-]GNet Server
 |  |  | [+]Commands
 |  |  | [+]Forum
 |  |  | [+]Protocol
 |  |  | [-]Source
 |  | [+]About
 |  | [+]Forum
 |  | [+]License
 | [+]Cards of Tridala
 | [+]Flash Games
 | [+]Vagabond's Quest+
 | [+]Vagabond's Quest v.2
 | [+]Projects
[+]NetDragons.com Live!
[+]Reward Center
[+]Software Center
[+]Company Information
[+]Personal Services
[+]Member Directory
[+]Free E-mail
[+]Buy Cool Stuff
[+]Posters
[+]Your Privacy

Class gnsd


[ Source | Index | Back to GNS ]

public class gnsd
extends Object
gnsd - Controls server level functions such as group control, user count,

Loads cofinguration file, and starts the primary server thread that waits for user connection. A new user thread is spawned for every open connection. Also handls joining of groups, lists, and user count.


Variable Index

 o client
Used to manage incoming client connections.
 o DEBUG
Tells the server to Output debug information.
 o groups
Stores information about the current groups.
 o log
Used to log major commands to PATH/log/access_log.
 o PATH
Stores information about where data files are located.
 o PORT
Stores information about the activate port.
 o QUEUE
Store information about how many port to queue.
 o userCount
Stores how many users are on-line currently.

Constructor Index

 o gnsd(String)
Starts the General Network Server.

Method Index

 o authenticate(int, String)
Allows the user to authenticate to the server.
 o checkGroup(int)
Checks to see if a group is already formed.
 o getList(int, User)
Returns a list of groups back to the user based on their gameID.
 o getPath()
Returns the servers PATH.
 o getUserCount()
Gets how many users are currently on-line.
 o join(int, User)
Allows a user to join a group.
 o joinNew(int, int, String, String, User)
Will create a new group and allow a user to join it.
 o loadConf(String)
Allows the server to be configured at runtime.
 o main(String[])
Tells the Application load.
 o remove(Group)
Will remove a group from the group vector.
 o setLogger(logger)
Sets which log class we should use.
 o toInt(String)
Converts a String to an int;
 o userCount(int)
Function is used to manage the user count.

Variables

 o log
 private logger log
Used to log major commands to PATH/log/access_log. This will log @connect, @login, @join, @joinnew, @list, @part, and @logout. Logs are timestamped via time_t, information about the user's host, command, and other useful information is given.

 o client
 private Socket client
Used to manage incoming client connections.

 o PATH
 private String PATH
Stores information about where data files are located. Read from the configuration file.

See Also:
loadConf
 o PORT
 private int PORT
Stores information about the activate port. Default value is 5000, can be changed through the configuration file.

See Also:
loadConf
 o QUEUE
 private int QUEUE
Store information about how many port to queue. Default value is 512, can be changed through the configuration file.

See Also:
loadConf
 o DEBUG
 private boolean DEBUG
Tells the server to Output debug information. Useful when you are trying to build a new game, or just make sure the server is working. Default value is false, can be changed through the configuration file.

See Also:
loadConf
 o userCount
 private int userCount
Stores how many users are on-line currently.

 o groups
 private static Vector groups
Stores information about the current groups.

Constructors

 o gnsd
 public gnsd(String file) throws IOException
Starts the General Network Server. This is the primary working function, it loads all configuration variables, starts the server and waits for new connections.

Parameters:
files - Configuration file to be loaded.
See Also:
loadConf

Methods

 o main
 public static void main(String args[]) throws IOException
Tells the Application load. This functions makes sure that we have the proper number of arugments (0 or 1). If we don't have any arugments the configure files is set to ./gnsd.conf. If an arugment is given, we use that as the configure file.

 o setLogger
 public final void setLogger(logger l)
Sets which log class we should use.

 o getPath
 public final String getPath()
Returns the servers PATH. This is used by sub classes in order to maintain an acurate data without having to hardcode information.

 o userCount
 public void userCount(int i)
Function is used to manage the user count. If you call the function with a +1, a user is added to the count, call it with a -1, and a user is substracted.

Parameters:
i - How many users to add to the count.
 o getUserCount
 public int getUserCount()
Gets how many users are currently on-line.

Returns:
number of users currently on-line.
 o getList
 public void getList(int gID,
                     User u)
Returns a list of groups back to the user based on their gameID. Designed to list all the channels that the player can join and return it to the user one line at a time. Data sent back to the user is, groupID, title, mode, and user count.

Parameters:
gID - the game ID to match on
u - Instance of the user so we can send data.
 o checkGroup
 public boolean checkGroup(int cID)
Checks to see if a group is already formed. This function is used when the user trys to join a channel. If the channel does not exist, the @joinnew command must be used. If the @joinnew command wased used and the channel exists, it's just like using @join.

Parameters:
cID - id to check
 o authenticate
 public String authenticate(int uID,
                            String uPassword)
Allows the user to authenticate to the server. Loads PATH/users.dbf and checks to make sure that both the given user name nad password are correct. users.dbf is a database file seperated by a ",". Read fields are name, password, ID.

Parameters:
uID - the users ID number
uPassword - the users password
Returns:
the players name if ID and password were correct, logout otherwise.
 o join
 public void join(int cID,
                  User u)
Allows a user to join a group. Finds the channel the user request to join and adds them to the list. If the channel does not exist, a new "Network" channel is made, this is to handle the auto join feature.

Parameters:
cID - the ID of the group to join.
u - Instance of the User.
 o joinNew
 public void joinNew(int cID,
                     int gID,
                     String title,
                     String mode,
                     User u)
Will create a new group and allow a user to join it. Much like the join function, except this will create a new group for users to join.

Parameters:
cID - group ID to create
gID - game ID from client.
title - title/topic of the group
mode - information about the type of channel
u - Instance of the User.
See Also:
join
 o remove
 public void remove(Group g)
Will remove a group from the group vector. When a channel doesn't have any more users in it this function allows it to be closed down.

Parameters:
g - the group to be closed.
 o loadConf
 private void loadConf(String f)
Allows the server to be configured at runtime. There are 4 options that can be set, PATH, PORT, QUEUE, and DEBUG. To set an option, simple use It's name, a space, and the value of the option, such as PORT 4000. When you run the General Network Server, you will see all the runtime options that are set.

Parameters:
f - file to load.
 o toInt
 private int toInt(String s)
Converts a String to an int;

Parameters:
s - The String to be converted
Returns:
an int value from s
ND: VQ+, Mail, Shop, Free Web Hosting Free Stock Screener

Edgar Degas Posters
Copyrighted �, 2000, 2001 by NetDragons.com
Last Updated Sunday, March 21, 1999 - 23:55 EST