nguyenvulebinh / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

using interfaces in communication #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I created a interface say 'A' which is implemented by 'B' and 'C'
2. I want to send 'B' or 'C' from client and without knowing server will 
forword them to other client. 
3. So I am accepting them at server side as 'A'
4. If i register 'A' it gives error that 'A' does not have default constructor.
5. If i do not register 'A' then it gives error that class 'A' not registered

What version of the product are you using? On what operating system?
kryonet 2.18 , redhat

Please provide any additional information below.

Really nice product !! :)

Original issue reported on code.google.com by rohith...@gmail.com on 15 Sep 2012 at 6:39

GoogleCodeExporter commented 9 years ago
If the server receives the objects, it has to know about the classes. You can 
serialize the objects to byte[], then the server will not try to deserialize. 
Forward the bytes to the other client, who would deserialize the byte[]. See 
Kryo docs for how to serialized/deserialize to/from bytes.

Original comment by nathan.s...@gmail.com on 18 Sep 2012 at 8:33