Share the code to copy and results screenshot Assignment-2: Java Networking This application consists of a POJO
Question:
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.
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill