Package top.focess.qq.core.net
Class FocessUDPMultiReceiver
- java.lang.Object
-
- top.focess.qq.core.net.FocessUDPMultiReceiver
-
- All Implemented Interfaces:
Receiver,ServerMultiReceiver,ServerReceiver
public class FocessUDPMultiReceiver extends Object implements ServerMultiReceiver
-
-
Constructor Summary
Constructors Constructor Description FocessUDPMultiReceiver(FocessUDPSocket focessUDPSocket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the receiver.List<Client>getClients(String name)Get the list of the clients with given namebooleanisConnected(String client)Indicate the client is connected to servervoidonClientPacket(ClientPackPacket packet)voidonConnect(ConnectPacket packet)voidonDisconnect(DisconnectPacket packet)voidonHeart(HeartPacket packet)<T extends Packet>
voidregisterPackHandler(String name, Class<T> c, PackHandler<T> packHandler)Register packet handler for special clientvoidsendPacket(int id, Packet packet)Send packet to the special clientvoidsendPacket(String client, Packet packet)Send packet to the special client-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface top.focess.qq.api.net.ServerMultiReceiver
getClient
-
-
-
-
Constructor Detail
-
FocessUDPMultiReceiver
public FocessUDPMultiReceiver(FocessUDPSocket focessUDPSocket)
-
-
Method Detail
-
close
public void close()
Description copied from interface:ReceiverClose the receiver.
-
onConnect
public void onConnect(ConnectPacket packet)
-
onDisconnect
public void onDisconnect(DisconnectPacket packet)
-
onHeart
public void onHeart(HeartPacket packet)
-
onClientPacket
public void onClientPacket(ClientPackPacket packet)
-
sendPacket
public void sendPacket(String client, Packet packet)
Description copied from interface:ServerReceiverSend packet to the special client- Specified by:
sendPacketin interfaceServerReceiver- Parameters:
client- the client namepacket- the packet
-
registerPackHandler
public <T extends Packet> void registerPackHandler(String name, Class<T> c, PackHandler<T> packHandler)
Description copied from interface:ServerReceiverRegister packet handler for special client- Specified by:
registerPackHandlerin interfaceServerReceiver- Type Parameters:
T- the packet type- Parameters:
name- the client namec- the packet classpackHandler- the packet handler
-
isConnected
public boolean isConnected(String client)
Description copied from interface:ServerReceiverIndicate the client is connected to server- Specified by:
isConnectedin interfaceServerReceiver- Parameters:
client- the client name- Returns:
- true if the client is connected to server, false otherwise
-
sendPacket
public void sendPacket(int id, Packet packet)Description copied from interface:ServerMultiReceiverSend packet to the special client- Specified by:
sendPacketin interfaceServerMultiReceiver- Parameters:
id- the client idpacket- the packet
-
getClients
public List<Client> getClients(String name)
Description copied from interface:ServerMultiReceiverGet the list of the clients with given name- Specified by:
getClientsin interfaceServerMultiReceiver- Parameters:
name- the client name- Returns:
- the list of the clients with given name
-
-