Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Share the code to copy and results screenshot Assignment-2: Java Networking This application consists of a POJO (Plain Old Java Object) Book, SerializationClient , and

Share the code to copy and results screenshot


Assignment-2: Java Networking

This application consists of a POJO (Plain Old Java Object) Book, SerializationClient, andSerializationServerclasses.

The Book is a simple POJO with fields String isbn, String title, Float price.

It should have a constructor, initializing an instance of the POJO based on user input of a Book isbn, title, price. It should also have standard getter and setter methods, as well as toString()method.

The SerializationClient and SerializationServer handle the Bookinstance serialization and deserializaton process, that can be described in the following workflow:

The SerializationClientclass:

  • Based on user input isbn, title, price creates an instance of the book to be serialized and sent to the String isbn, String title, Float price.
  • To be able to do that, the SerializationClientshould create an instance of the Socketclass on localhost 127.0.0.1 and a port (e.g. 10007).
  • After that, the SerializationClientis able to the create necessary I/O Streams and send the serialized instance of theBook to the SerializationServer.

The SerializationServerclass:

  • Creates instance of the ServerSocketon the same port as the Client (e.g. 10007).
  • Calls its accept() method waiting for a Client to contact the Server.
  • Creates the create necessary I/O Streams and deserializes the Book instance sent by the Client.
  • Based on user input, the Server changes the book price and sends the changed instance back to the Client.
  • After that, the Server is able to close all open streams and sockets.

The SerializationClientclass:

  • Receives the serialized changed book instance from the Server.
  • Then the Clientdeserializes the changed book instance and sends it to the output.
  • After that, the Client is able to close all open streams and client socket.



Step by Step Solution

There are 3 Steps involved in it

Step: 1

Solution Bookjava java import javaioSerializable public class Book implements Serializable private String isbn private String title private float pric... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Programming questions

Question

Why is dust attracted to a DVD wiped with a dry cloth?

Answered: 1 week ago