Server
Class Server

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--Server.Server
All Implemented Interfaces:
java.lang.Runnable

public class Server
extends java.lang.Thread

A server waiting for connections


Field Summary
private  java.net.ServerSocket serverSocket
          ServerSocket on which the server is working.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritableThreadLocals, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadLocals, threadQ
 
Constructor Summary
Server(int server_port, int max_connections)
          Initializes the server and its configuration.
 
Method Summary
 java.net.Socket listen()
          Wait for a client connection
static void main(java.lang.String[] args)
          Main front-end for the server.
 void run()
          A front-end for the server thread.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serverSocket

private final java.net.ServerSocket serverSocket
ServerSocket on which the server is working.
Constructor Detail

Server

public Server(int server_port,
              int max_connections)
       throws java.io.IOException
Initializes the server and its configuration.
Parameters:
server_port - The port to listen
max_connections - Maximum number of concurrent connections to the server
Method Detail

listen

public final java.net.Socket listen()
Wait for a client connection
Returns:
The incoming socket request

run

public final void run()
A front-end for the server thread. Wait for incoming sockets and instantiate SocketThread for each.
Overrides:
run in class java.lang.Thread

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Main front-end for the server. Simply start the server thread.
Parameters:
args -  
Throws:
java.io.IOException -