Re-stepping on Java Road _day26 (network programming)

Source: Internet
Author: User

1: Network Programming (understanding)
(1) Network programming: Using Java language to realize the information transmission and resource sharing between computer data
(2) Network programming model
(3) Three elements of network programming
A:ip Address
A: Dotted decimal
B:ip the composition of the address
Classification of C:IP addresses
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, not connected, high efficiency, unreliable
TCP: Set up data channel, no limit, low efficiency, reliable
(3) Socket mechanism
A: Both ends of the communication should have a socket object
B: All communication is performed via IO between sockets
(4) The UDP protocol sends and receives data (mastering its own code)
Send:
Create a socket object on the UDP send side
Create data and package the data
Send data
Freeing resources

Receive:
Creating a Socket object on the UDP receive side
Create a packet to receive data
Receive data
Parsing packets
Freeing resources
(5) The TCP protocol sends and receives data (mastering its own code)
Send:
Creating a Socket object for a TCP client
Get output stream, write data
Freeing resources

Receive:
Create a TCP server-side Socket object
Listening for client connections
Get input stream, read data
Freeing 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: A simple chat applet with multithreading improvements
B:tcp
A: The most basic TCP protocol to send and receive data
B: The server gives 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: Upload Images
H: Multithreading improved Upload file

Re-stepping on Java Road _day26 (network programming)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.