public class MoldUDP64Server extends Object implements Closeable
Constructor and Description |
---|
MoldUDP64Server(Clock clock,
DatagramChannel channel,
String session)
Create a server.
|
MoldUDP64Server(DatagramChannel channel,
String session)
Create a server.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying datagram channel.
|
DatagramChannel |
getChannel()
Get the underlying datagram channel.
|
void |
keepAlive()
Keep the session alive.
|
void |
send(MoldUDP64DownstreamPacket packet)
Send a downstream packet.
|
void |
sendEndOfSession()
Send a downstream packet indicating the End of Session.
|
void |
sendHeartbeat()
Send a downstream packet indicating a Heartbeat.
|
public MoldUDP64Server(DatagramChannel channel, String session)
channel
- the underlying datagram channelsession
- the session namepublic MoldUDP64Server(Clock clock, DatagramChannel channel, String session)
clock
- a clockchannel
- the underlying datagram channelsession
- the session namepublic DatagramChannel getChannel()
public void send(MoldUDP64DownstreamPacket packet) throws IOException
packet
- a downstream packetIOException
- if an I/O error occurspublic void sendHeartbeat() throws IOException
IOException
- if an I/O error occurspublic void sendEndOfSession() throws IOException
IOException
- if an I/O error occurspublic void keepAlive() throws IOException
If the heartbeat interval duration has passed since the last downstream packet indicating a Heartbeat was sent, send a downstream packet indicating a Heartbeat.
IOException
- if an I/O error occurspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if an I/O error occursCopyright © 2017. All rights reserved.