What's a good way to sync objects over a socket connection?
Here's what I've thought of so far.
An object, in its getters and setters, calls an Update method that transfers all of the class's information over the socket connection to other connected clients. To update these changes on the clients, a overloaded method is called that basically parses a string for the values of its members and sets them accordingly.
Is this a reasonable way to go about things? For what I've read on how Raknet does its stuff, it has you implement specific methods that it expects to call whenever an object needs to be updated.
I can see this working, maybe inefficiently, if all the data you're deal with is primitive types. But what about other classes? Is it reasonable to expect the user on an API to call this method described above in their own classes? What if they're using a standard data structure that doesn't have the method overrided.
I know there's things like the WCF that do this for you, but I really want to implement my own solution, even if it's not optimal like WCF may be.
Thanks for any advice SO users! :)