Package top.focess.qq.core.net
Class FocessSidedClientReceiver
- java.lang.Object
-
- top.focess.qq.core.net.FocessSidedClientReceiver
-
- All Implemented Interfaces:
ClientReceiver,Receiver
public class FocessSidedClientReceiver extends Object implements ClientReceiver
-
-
Constructor Summary
Constructors Constructor Description FocessSidedClientReceiver(FocessSidedClientSocket focessSidedClientSocket, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the receiver.intgetClientId()Get the client idStringgetClientToken()Get the client tokenStringgetHost()Get the target host of the clientStringgetName()Get the name of the clientintgetPort()Get the target port of the clientbooleanisConnected()Indicate this client has connected to a servervoidonConnected(ConnectedPacket packet)voidonDisconnected(DisconnectedPacket packet)voidonServerPacket(ServerPackPacket packet)<T extends Packet>
voidregisterPackHandler(Class<T> c, PackHandler<T> packHandler)Register packet handler for servervoidsendPacket(Packet packet)Send the packet to the server
-
-
-
Constructor Detail
-
FocessSidedClientReceiver
public FocessSidedClientReceiver(FocessSidedClientSocket focessSidedClientSocket, String name)
-
-
Method Detail
-
sendPacket
public void sendPacket(Packet packet)
Description copied from interface:ClientReceiverSend the packet to the server- Specified by:
sendPacketin interfaceClientReceiver- Parameters:
packet- the packet
-
onConnected
public void onConnected(ConnectedPacket packet)
-
onDisconnected
public void onDisconnected(DisconnectedPacket packet)
-
onServerPacket
public void onServerPacket(ServerPackPacket packet)
-
registerPackHandler
public <T extends Packet> void registerPackHandler(Class<T> c, PackHandler<T> packHandler)
Description copied from interface:ClientReceiverRegister packet handler for server- Specified by:
registerPackHandlerin interfaceClientReceiver- Type Parameters:
T- the packet type- Parameters:
c- the packet classpackHandler- the packet handler
-
getHost
public String getHost()
Description copied from interface:ClientReceiverGet the target host of the client- Specified by:
getHostin interfaceClientReceiver- Returns:
- the target host of the client
-
getPort
public int getPort()
Description copied from interface:ClientReceiverGet the target port of the client- Specified by:
getPortin interfaceClientReceiver- Returns:
- the target port of the client
-
isConnected
public boolean isConnected()
Description copied from interface:ClientReceiverIndicate this client has connected to a server- Specified by:
isConnectedin interfaceClientReceiver- Returns:
- true if the client has connected to a server, false otherwise
-
getClientId
public int getClientId()
Description copied from interface:ClientReceiverGet the client id- Specified by:
getClientIdin interfaceClientReceiver- Returns:
- the client id
-
getClientToken
public String getClientToken()
Description copied from interface:ClientReceiverGet the client token- Specified by:
getClientTokenin interfaceClientReceiver- Returns:
- the client token
-
getName
public String getName()
Description copied from interface:ClientReceiverGet the name of the client- Specified by:
getNamein interfaceClientReceiver- Returns:
- the name of the client
-
-