Skip to main content

Lab Work Answers

Lab 2

Marshalling

Does each method of encoding (UTF-8 String, Data stream, JSON, XML and Object stream) successfully read back the same value as was written?

  • They all do?

For the first (string) encoding, how many characters are in the string? How many bytes are in the message? Why

  • 7 Characters, and 8 bytes.

For the first (string) encoding, would you need to send any extra information apart from the bytes? Why/why not? (hint: would the receiver know that they had received the full message?)

What would be the limitations of just sending strings using the first method? When might another of the methods be better?

For the second (data output stream) encoding, what two types/values does it write How are they encoded in the byte stream?

What two types/values does it read? What would happen if the reading code attempted to read different types/values?

What limitation(s) does this impose? When might another of the methods be better?

UDP

Server

Client

TCP