Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the understanding of network programming?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

What is the understanding of network programming, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

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: dotted decimal system

Composition of b:IP addresses

Classification of c:IP addresses

D:dos command

E:InetAddress

B: Port

Is the identity of the application. Range: 0-65535. Among them, 0-1024 is not recommended.

C: protocol

UDP: data packaging, limited, disconnected, efficient, unreliable

TCP: establish data channel, unlimited, inefficient and reliable

(3) Socket mechanism

A: there should be Socket objects on both sides of the communication

B: all communications are operated through the IO between Socket

(4) UDP protocol sends and receives data (master self-completion code)

Send:

Create a Socket object on the sender side of UDP

Create data and package it

Send data

Release resources

Receive:

Create a Socket object on the receiving end of UDP

Create packets to receive data

Receive data

Parse the packet

Release resources

(5) TCP protocol sends and receives data (master self-completion code)

Send:

Create a Socket object for the TCP client

Get the output stream and write the data

Release resources

Receive:

Create a Socket object on the TCP server side

Monitor client connection

Get input stream, read data

Release resources

(6) case:

A:UDP

A: the most basic UDP protocol sends and receives data

B: improve the sending data to keyboard input

C: a simple chat Mini Program and improved with multithreading

B:TCP

A: the most basic TCP protocol sends and receives data

B: the server gives feedback

C: client keyboard input server console output

D: the client keyboard entry server writes to the text file

E: the client reads the text file server console output

F: the client reads the text file server writes to the text file

G: upload pictures

H: multithreading improves uploading files

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 264

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report