public class BroadcastService
extends java.lang.Thread
Thread because, as long as it is open, it must accept all the
incoming clients.| Constructor and Description |
|---|
BroadcastService(int port)
Basic broadcast service constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method to close the current broadcasting service and shutdown the thread
that listens for new clients.
|
void |
open()
Method to open the broadcasting service.
|
void |
open(int port)
Method to open the broadcasting service.
|
void |
run() |
void |
send(java.lang.String message)
This method sends a message to all the clients connected.
|
activeCount, checkAccess, clone, 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, yieldpublic BroadcastService(int port)
port - the port for the connectionspublic void open()
throws java.io.IOException
Thread.start() method.java.io.IOException - socket opening errors (e.g. port already used)public void open(int port)
throws java.io.IOException
Thread.start() method.port - the port for the connectionsjava.io.IOException - socket opening errors (e.g. port already used)public void close()
throws java.io.IOException
Thread.join().java.io.IOExceptionpublic void send(java.lang.String message)
message - the message to be sentpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Thread