1: Network Programming (understanding) (1) network programming: Using Java language to realize data transmission and resource sharing between computers (2) network programming model (3) Three elements of network programming A:IP address a: Dot decimal  B:IP address composition  C:IP address classification d:dos command e:InetAddress B: Port is the identity of the application. Range: 0-65535. 0-1024 of them are not recommended for use. C: Protocol  UDP: Data packaging, limited, non-connected, high efficiency, unreliable  TCP: establishing data channels, unlimited, inefficient, reliable (3) socket mechanism A: Both ends of the communication should have the socket object B: All communication is operated through the IO between sockets (4) The UDP protocol sends and receives data (mastering its own code) sending: Create a UDP Sender socket object Create data and package data Send data Release resources receive: Create a socket object on the UDP receiver Create a packet to receive data receive data Resolve packet release resource (5) TCP protocol to send and receive data (Master your own code) Send: Create a TCP Client socket object Get output stream, write data release resources receive: Create a TCP server-side socket object Listen for client connections Get input stream, read data release resources (6) Case: A:UDP a: The most basic UDP protocol to send and receive data  B: Improve the sending data to keyboard input  C: aA simple chat applet with multithreading improvements b:tcp a: The most basic TCP protocol to send and receive data  B: Server feedback c: Client keyboard input Server console output  D: Client keyboard Input server writes to text file e: Client reads text file server console output  F: Client reads text file server writes to text file g: Uploading images  H: Multithreading improvements uploading files
Java Network programming note