Java network programming (Socket, ServerSocket, DatagramPackage, DatagramSocket)

Directory 1. Network programming 2. Echo model (the server communicates with the client) 3. BIO processing model (realize multi-user access to the same server) 4. UDP program 1. Network programming There are two communication models C/S (Client/Server) is based on the client and the server, and the client and the server need to be implemented […]

javanet.Socket, javanet.ServerSocket, and javanetDatagramSocket

In Java, a socket (Socket) is a mechanism for communicating over a network. Java provides several socket classes related to network communication, including java.net.Socket, java.net.ServerSocket and java.net.DatagramSocket . These classes allow Java programs to communicate over networks via TCP and UDP protocols. java.net.Socket: The Socket class represents the communication endpoint between the client and the […]

socket, serversocket, websocket

1. Socket class Socket allows an application to read and write data from the network, and two applications on different computers can send and receive byte streams over the connection. When sending a message, you need to know the other party’s ip and port. In java, socket refers to the java.net.Socket class. In java.net.Socket, you […]

[Network programming] (TCP stream socket programming ServerSocket API Socket API handwritten TCP version echo server TCP long and short connections)

Article directory network programming TCP stream socket programming ServerSocket API Socket APIs Long and short connections in TCP Handwritten TCP version of the echo server Network programming TCP stream socket programming The API provided by TCP is mainly two classes: ServerSocket and Socket. TCP does not need a class to represent “TCP datagram” because TCP […]

Difference between ServerSocketChannel and ServerSocket (SpringBoot version)

ServerSocketChannel and ServerSocket are two different classes dealing with network programming in Java, and they have some differences in function and usage 1. ServerSocketChannel: (1) ServerSocketChannel is a channel in the Java NIO library, which is used to monitor and accept client connections. (2) ServerSocketChannel provides support for non-blocking mode, which can be set to […]