javaweb final review-network protocol, socket, serversocket, non-blocking communication, non-blocking HTTP, UDP, serialization

Knowledge is fragmentary, only for exams

Chapter 1 Getting Started

Insert picture description hereInsert picture description hereInsert picture description here

Chapter 2 Socket

I feel that socket is a link in the CS architecture.
Delayed waiting
Insert picture description here
related methods are Insert picture description hereInsert picture description here
half closed.
It is necessary to carry a simple client and server side.
Insert picture description hereInsert picture description here

It is necessary to back a stream operation
Insert picture description hereInsert picture description hereInsert picture description hereInsert picture description hereInsert picture description here

Chapter 3 SERVER SOCKET

Insert picture description here
The construction method
Insert picture description here
Insert picture description here
port is set to 0 to be an anonymous port. It
Insert picture description here
feels that as long as the backlog parameter value is illegal or not, it is the operating system decision.
Insert picture description here
This construction method is suitable for
Insert picture description here
the usage of multiple ip accept methods.
Insert picture description here
Insert picture description hereInsert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Multithreading skips, I don’t want to read @-@
Insert picture description hereInsert picture description here56两问在There are advantages and disadvantages of threads

Chapter 4 Non-blocking Communication

Insert picture description here

Insert picture description here

Insert picture description here
The concept of Insert picture description here
a blocking operating system Common causes of blocking:

  • sleep
  • wait
  • accept
  • Input and output stream
  • connect
  • Sync code
  • IO operation/remote communication
  • Shutdown delay time and other
    blocking limitations. The
    Insert picture description here
    Insert picture description here
    limitation is that the virtual machine opens up memory space
    frequently and frequently schedules cpu

Insert picture description here
Non-blocking principle
Insert picture description here
Insert picture description here
This concept is really
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
daunting. Let's look at non-blocking code later. . .

Later he comes

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Postion is similar to a pointer. Capacity is the total buffer. Limit means that the following will not belong to the buffer. Insert picture description here
Insert picture description here
Insert picture description here
Position and limit change after the read operation
. When writing, put (buffer.getbyte()) is required for
reading.
Insert picture description here
Insert picture description here
Insert picture description here
So the above code is used Allocate creates a buffer in the jvm,
allocatedirect, to open up important and long-term use. Although it is efficient, it occupies memory space and Insert picture description here
Insert picture description here
acts as a link, and does not directly return data
Insert picture description here
. This is how the current channel is, before the cpu directly controlled io
Either DMA management io
can operate asynchronously under channelInsert picture description here

Insert picture description here
Insert picture description here
Insert picture description here

Chapter 5: Creating non-blocking HTTP

Insert picture description here
Insert picture description here
Insert picture description here

HTTP requests are divided into request methods, request headers, request body,
Insert picture description here
and the difference between get and post. One gets one submission form, one has more data, and one has less data. The
Insert picture description here
Insert picture description here
HTTP response is also divided into three parts, http version, status, and response header , The response body The Insert picture description here
Insert picture description here
Insert picture description here
specific code is ignored

Insert picture description here
Insert picture description here

Chapter 8 UDP-based datagrams and sockets

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
In the two udp interactions I wrote earlier, I saw that datagramsocket is only responsible for receiving and sending.
The real transmission is to
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
send through datagrampacket, it can only be a sequence of bytes, and then change it back to the receiver
Insert picture description here
Insert picture description here
Insert picture description here
. I didn’t see the non-blocking in the back
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Chapter 9 Serialization and Deserialization

Insert picture description hereInsert picture description here

Insert picture description here
Self-built Customer class inherits the Serializable interface to complete serialization and deserialization.
Insert picture description here
Static variables will not be serialized.
Insert picture description here
Deserialization will not call the construction method. It will only fetch data directly from memory. The
Insert picture description here
Insert picture description here
externalizable interface will be used during deserialization. Parameter construction method
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description hereInsert picture description here

JDBC

Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here
Insert picture description here

Chapter 15 jsse

Insert picture description here
Insert picture description here

Remember
Jsse: java secure socket extension java secure socket extension
SSL: server socket layer
TLS: transport Layer Security

Guess you like

Origin blog.csdn.net/qq_43430273/article/details/106954870