com.xfactorstudio.ahawasi
Class SocketService

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.xfactorstudio.ahawasi.SocketService
All Implemented Interfaces:
java.lang.Runnable

public class SocketService
extends java.lang.Thread

The Socket Service

Version:
.91
Author:
Neeld Tanksley

Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SocketService()
           
SocketService(XMLElement ConfXML, Ahawasi server)
           
 
Method Summary
 void addClient(ClientThread tempClient)
          This method adds a new client Thread to the client list
 void close()
           
 java.lang.String getApplicationVariable(java.lang.String varName)
          return the application variable specified by the key
 java.util.Hashtable getApplicationVariables()
          return the application variables Hashtable
 ClientThread getClient(long clientId)
           
 ClientList getClientList()
          return the current clientList
 int getMaxMessageSize()
          return the maximum message size accepted This helps prevent attempts to crash the server.
 int getMaxUsers()
          return the number of users allowed to access this service
 int getPort()
          return the current port
 java.lang.String getServiceName()
           
 void removeAllClients()
          This method removes all clients
 void removeClient(ClientThread deadClient)
          This method removes a dead connection from the client list
 void removeClient(long userId)
          This method removes a dead connection from the client list
 void run()
           
 void sendTo(java.lang.String message, long to)
          This method sends the specified user the private message
 void sendTo(java.lang.String message, java.lang.String userName)
          This method sends the specified user the private message
 void sendToAll(java.lang.String message)
          This method loops through the client list for the specified room and send everyone the current message
 java.lang.String toXML()
           
 java.lang.String toXMLDetailed()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketService

public SocketService()

SocketService

public SocketService(XMLElement ConfXML,
                     Ahawasi server)
Method Detail

getServiceName

public java.lang.String getServiceName()

close

public void close()

run

public void run()
Overrides:
run in class java.lang.Thread

getPort

public int getPort()
return the current port

getMaxUsers

public int getMaxUsers()
return the number of users allowed to access this service

getMaxMessageSize

public int getMaxMessageSize()
return the maximum message size accepted This helps prevent attempts to crash the server. The client will be disconnected beyond this value

getClientList

public ClientList getClientList()
return the current clientList

sendToAll

public void sendToAll(java.lang.String message)
This method loops through the client list for the specified room and send everyone the current message

addClient

public void addClient(ClientThread tempClient)
This method adds a new client Thread to the client list

removeAllClients

public void removeAllClients()
This method removes all clients

removeClient

public void removeClient(ClientThread deadClient)
This method removes a dead connection from the client list

removeClient

public void removeClient(long userId)
This method removes a dead connection from the client list

sendTo

public void sendTo(java.lang.String message,
                   long to)
This method sends the specified user the private message

sendTo

public void sendTo(java.lang.String message,
                   java.lang.String userName)
This method sends the specified user the private message

getApplicationVariables

public java.util.Hashtable getApplicationVariables()
return the application variables Hashtable

getApplicationVariable

public java.lang.String getApplicationVariable(java.lang.String varName)
return the application variable specified by the key

getClient

public ClientThread getClient(long clientId)

toXML

public java.lang.String toXML()

toXMLDetailed

public java.lang.String toXMLDetailed()