Sending an object through a socket in java

后端 未结 2 733
旧时难觅i
旧时难觅i 2020-12-08 11:30

I have 2 java netbeans projects, one is the Server other is the Client. I have a Message class that I have created which I want to pass to the server and back the other way

相关标签:
2条回答
  • 2020-12-08 12:20

    Make sure that Message on server side is rusl.online.examination.system.client.utility.Message. It seems not to be the case.

    0 讨论(0)
  • 2020-12-08 12:24

    If you are sending objects of a class over the socket. In order to reproduce the object at the other end, you have to cast the object. For that you will require the class definition on both ends.

    Make sure you properly import the same Message class for server program as well, which you used to create the message.

    0 讨论(0)
提交回复
热议问题