- We have seen several examples to controlling concurrency:
- Locks
- Immutable objects
- Single-threaded service
with the latest being single-threaded service. Be familiar with
this techinque and be prepared to apply it to avoid bad race conditions.
- Network programming
- Basic operations on a socket (receive/send a byte)
- Decorators such as DataInput and DataOutput that can send and receive primitive data types
- In what order are the bytes of a 4-byte integer sent and received
using network order (Java sends ints that way)
- We saw two ways of representing the contents of a String:
- UTF: length of the string is transmitted first, followed by the
string's characters
- null-terminated: a null (numeric 0) is sent just after the last
character of the string.
What are the advantages and disadvantages of each approach?
- Protocol design
- Getting the job done: sending and receiving information reliably
- Constraints that affect protocol design (engineering considerations)
- Performance (throughput, latency)
- Security (what is done where?)
- Simple encryption
-
For practice, consider how you would design a protocol and write the
corresponding code to transmit and receive
the following:
- A Battleship game board
- A pizza order
- A list of integers
- A set of integers
- A BigInteger
- A Roman numeral