• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serialization of object in network  RSS feed

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know whether it is a correct forum to post this question or not.
I have studied some material on java serialization of object. i have some doubts, if we have a server class which receives data coming from client and client class which has to send data to server. Message class is a serialized class class used to pass data over network.
1) My doubt is if i have to pass data from client to server which are running in different systems and different jvm(version is same) am i need to write message class in both sides with same package extension.
Eg: If my server program has to classes in it server.class and Message.class in a package com.xyz. and my client program running in a remote place which has client.class and Message.class in different package name com.abc . if i serialize and send message is there any trouble with DE-serialization.
2) If both JVM's versions are different then is serialization works.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the Message class would need to be exactly the same on both sides. It would need to be in the same package. you should just re-use the code of the Message class on both sides.

It should work without any problem if the JRE versions on the server and client are different.
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for reply i have a question how to detect a server which is running on a LAN environment.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!