public class StreamingServer
extends java.lang.Object
DataEntry
s to registered
StreamingClient
s, as well as connecting and disconnecting new
clients.Constructor and Description |
---|
StreamingServer(int port,
NetworkProtocol protocol)
Creates a new
StreamingServer . |
Modifier and Type | Method and Description |
---|---|
void |
connect()
Lets the
StreamingServer connect itself to the port specified in
the StreamingServer(int, NetworkProtocol) . |
void |
disconnect()
First disconnects all
StreamingClient s from the server, then
closes the StreamingServer 's socket. |
boolean |
isConnected() |
void |
send(DataEntry data)
Sends a
DataEntry to all registered StreamingClient s. |
void |
sendHeader()
Sends the transmission-header to all registered
StreamingClient s. |
public StreamingServer(int port, NetworkProtocol protocol)
StreamingServer
.port
- the server is supposed to be sending on.protocol
- NetworkProtocol
the server is supposed to use.public void connect() throws java.io.IOException
StreamingServer
connect itself to the port specified in
the StreamingServer(int, NetworkProtocol)
.java.io.IOException
- if an I/O error occurs when opening the socket.public void sendHeader()
StreamingClient
s.public void send(DataEntry data)
DataEntry
to all registered StreamingClient
s.data
- public void disconnect()
StreamingClient
s from the server, then
closes the StreamingServer
's socket.public boolean isConnected()
StreamingServer
is connected and running or
not.