This version implements multi-threading, and the Server and client code are almost identical except for ServerSocket, and there are some problems at the end.
Harvest:
1. First multithreaded programming, sledgehammer, classes inherit the Runnable interface, write the code that requires another thread to the Run method, and start with the new Thread (this). Start ().
2. Can be sent without waiting to receive
3. In fact, quite simple, not long after writing.
Problem:
1.try catch, there are a lot of places to be forced to join, this place when writing a little bit.
2. Multithreaded programming also requires learning.
2. There are some minor problems in how to end, and the solution now is to put the buffer class in the run and start method into a class member, plus a shutdown method, which is
Receive bye and send bye all call shutdown method, there is no time to verify today.
2017-11-07 22:51:32
Java Socket server-client Mode 2.0