EsotericSoftware / kryonet

TCP/UDP client/server library for Java, based on Kryo
BSD 3-Clause "New" or "Revised" License
1.82k stars 419 forks source link

using interfaces in communication #26

Closed ghost closed 10 years ago

ghost commented 10 years ago

From rohith...@gmail.com on September 15, 2012 20:39:30

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: http://code.google.com/p/kryonet/issues/detail?id=25

ghost commented 10 years ago

From nathan.s...@gmail.com on September 18, 2012 13:33:09

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.

Status: WontFix