I'm using kryonet to send objects back and forth from a server and client. There is a listener that is run whenever an object has been received. The only way it seems to determine the object's instance is by using:
if(object instanceof ClientLoginPacket){
//Do stuff
}
I want to know what instanceof checks to determine if an object is of a specific type or not. Does it check if the class is exactly the same with all the code, does it check the variables and there names? Does it check the imported packages too? Any information you give me can help.
The reason I want to know this is because the way I'm making the packet, the code in the methods for the server are different from the client. For example, on my client to send the packets I do:
public void send(){
Client.sendPacketTCP(this);
}
and on my server I do this:
public void send(){
Server.sendPacketTCP(this);
}
Results of my test: Everything matters (variables, methods, package declarations, you name it!)
I don't understand why people say it's inaccurate, it's actually too accurate for what I want to do but I know what adjustments I need to make anyways.
Thank you everyone for you help!