Hey it’s me again with another problem
I’m currently Using Java.rmi with the standard serialization (even if it’s slow). and my problem is that i just don’t get how i can convert Textures, Materials and Spatials/Geometries the way that i can send them via normal Java.rmi
I tried sending a savable but it results in an error. I tried my luck with the BinaryExporter and BinaryImporter but seems like i’m too dumb for that.i can’t use the normal Serializer class either because with that method i have to register a class and applets need extra permissions for that. Well i want to avoid that.
Since normal serialization isn’t provided in the nightly build anymore i need an example(since the Javadoc isn’t very helpful with that) on how to convert the Spatials, Materials or Texture so that i can send them via normal java.serialization.
Since all three implement the Savable it would maybe the best way to get the Savable from those 3 and convert the Savable… but i was too dumb for that too
Hope somebody has a nice idea for my problem ^^
Use BinaryExporter, try to get smarter
Theres a few example classes that test and use Serialization, look at those.
The example TestOgreConvert shows how to convert a model into a byte[] and then back
the problem is that java.rmi doesn’t send byte[].
i solved the problem with
outgoing:
BinaryExporter->ByteArrayOutputStream->byte[]->List
intgoing:
BinaryImporter<-ByteArrayInputStream<-byte[]<-List
but is there a more efficient way to transer spatials/geometries using the standard java.rmi ?
If you have a method that takes byte[] and is enabled through RMI then RMI will transfer the byte[] parameter. RMI can transfer any serializable method argument, including primitive arrays.
I’m not sure what the issue is so we might need more information.
well i don’t know either what the problem with byte[] was but on the server side the byte[] was correctly written with a size of about 10k but the client only got 8 bytes and even they were wrong.
thats the reason why i use the List approach. ohh yeah the function called doesn’t return a byte [] but an object which includes the List of byte since byte[] didn’t work.
i think the client side didn’t set the buffer size right but can’t say for sure. i didn’t set any extra options for rmi only registry and rebind (server) and the lookup at the client.
i found close to nothing about that problem. i assume i have to reinstall java. might solve the problem.
thx for helping so far ^^
I haven’t used rmi in forever as it’s kind of slow as a networking layer but I don’t remember ever being limited on parameter size. Sending large objects just killed performance is all. I remember sending some pretty large strings and those are essentially just primitive arrays… but as I said, it’s been a long time.