mWokers
Class Server

java.lang.Object
  extended by java.lang.Thread
      extended by mWokers.Server
All Implemented Interfaces:
java.lang.Runnable

public class Server
extends java.lang.Thread

Version:
0.1.3.1b
Author:
suso

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Server(int port, boolean debug)
          This is the constructor of class Server, which is primary responsible for listening for messages, and forwarding them.
 
Method Summary
 java.lang.String getIPAdress()
           
 int getPort()
           
 boolean isConnected()
           
 boolean isDebuged()
           
 void run()
          this is the thread-method which tries to read data from the "port" all the time.
 void sendFile(User reci, User from, java.io.File file)
          this is the main file-sending method.
 void sendMessage(User reci, User from, java.lang.String msg)
          this is the main message-sending method.
 void startIRC()
          this method has got the purpose to start a new IRC-Server and connect to the irc-network!
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Server

public Server(int port,
              boolean debug)
This is the constructor of class Server, which is primary responsible for listening for messages, and forwarding them.

Parameters:
port - ... port on which the server will be listening for messages
debug - ... debug level (can be true or false)
Method Detail

startIRC

public void startIRC()
this method has got the purpose to start a new IRC-Server and connect to the irc-network!


sendMessage

public void sendMessage(User reci,
                        User from,
                        java.lang.String msg)
                 throws java.lang.Exception
this is the main message-sending method.

Parameters:
reci - ... recipiant of the message
from - ... sender of the message
msg - ... the message itself
Throws:
java.lang.Exception

sendFile

public void sendFile(User reci,
                     User from,
                     java.io.File file)
              throws java.lang.Exception
this is the main file-sending method.

Parameters:
reci - ... recipiant of the file
from - ... sender of the file
file - ... the file itself
Throws:
java.lang.Exception

run

public void run()
this is the thread-method which tries to read data from the "port" all the time.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getIPAdress

public java.lang.String getIPAdress()
                             throws java.lang.Exception
Returns:
ipV4 Adress as a String
Throws:
java.lang.Exception

getPort

public int getPort()
Returns:
the current port

isDebuged

public boolean isDebuged()
Returns:
debug level

isConnected

public boolean isConnected()
Returns:
the current state of the ServerSocket