Package server.logic.udp
Class UdpServerConnection
java.lang.Object
server.logic.udp.UdpServerConnection
- All Implemented Interfaces:
LargeResponseHandler
,ServerConnection
- Direct Known Subclasses:
UdpConnectionBlockDecorator
-
Field Summary
Modifier and TypeFieldDescriptionprotected SocketAddress
static final int
protected final DatagramChannel
-
Constructor Summary
ModifierConstructorDescriptionprotected
UdpServerConnection
(DatagramChannel channel, SocketAddress address) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLoopListener
(ListenLoopListener listener) void
addResponseListeners
(ServerResponseProvider... providers) void
Method for close a connectionvoid
Method for open a connection.void
readLargeObject
(int packetsCount, LargePacketProvider... packetProviders) void
removeLoopListener
(ListenLoopListener listener) void
removeResponseListeners
(ServerResponseProvider... providers) void
sendData
(byte[] bytesToSend) Method for send data to a server
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
-
channel
-
address
-
-
Constructor Details
-
UdpServerConnection
-
-
Method Details
-
openConnection
Method for open a connection.- Specified by:
openConnection
in interfaceServerConnection
- Throws:
IOException
- if I/O occurs
-
closeConnection
Method for close a connection- Specified by:
closeConnection
in interfaceServerConnection
- Throws:
IOException
- if I/O occurs
-
sendData
Description copied from interface:ServerConnection
Method for send data to a server- Specified by:
sendData
in interfaceServerConnection
- Parameters:
bytesToSend
- bytes to send- Throws:
IOException
- if I/O occurs
-
addResponseListeners
- Specified by:
addResponseListeners
in interfaceServerConnection
-
removeResponseListeners
- Specified by:
removeResponseListeners
in interfaceServerConnection
-
getLargeResponseHandler
- Specified by:
getLargeResponseHandler
in interfaceServerConnection
-
readLargeObject
- Specified by:
readLargeObject
in interfaceLargeResponseHandler
-
addLoopListener
- Specified by:
addLoopListener
in interfaceServerConnection
-
removeLoopListener
- Specified by:
removeLoopListener
in interfaceServerConnection
-