JavaEE-Network Programming Sockets (UDP/TCP)

Write a simple UDP client server process below Idea: For the server side: read the request and parse it –> make a response based on the parsed request (here is an echo,) –> write the response back to the client For the client: Read user input from the console –> Read user input from the […]

Use sockets to simulate information communication

1. Server import; import; import; import; import java.util.Scanner; public class Server { private static Socket socket; public static void main(String[] args) { try { System.out.println(“Socket server starts running…”); ServerSocket serverSocket = new ServerSocket(9999); while (true) { socket = serverSocket.accept(); new Thread(new Server_send(socket)).start(); new Thread(new Server_listen(socket)).start(); } } catch (Exception e) { […]

python-Socket based on UDP communication, use of socketserver module

1. Sockets based on UDP protocol communication UDP has no link, so whichever end is started first will not report an error. import socket server=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) server.bind((‘’,8082)) while True: data,client_addr=server.recvfrom(1024) print(data) server.sendto(data.upper(),client_addr) server.close() server import socket client=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) while True: msg=input(‘>>: ‘).strip() client.sendto(msg.encode(‘utf-8’),(‘’,8082)) data,server_addr=client.recvfrom(1024) print(data) client Since UDP has no connection, multiple clients can communicate with the […]

An example of using sockets to implement process communication

The function implemented by the following program is: the client sends the content entered from the keyboard to the server, and then the server sends the received data intact to the client. Let’s take a look at the server-side program first: 1: /* 2: * ============================================ ========================================= 3: * 4: * Filename: server.c 5: * […]

Interprocess Communication (IPC) Methods: UNIX Domain Sockets

UNIX domain socket (UNIX domain socket) provides us with a convenient way to establish communication channels between processes and has many useful built-in functions. Itsupports both stream-oriented (TCP) and datagram-oriented (UDP) protocols as TCP/IP internet sockets. We can also choose between blocking and non-blocking modes. First you need to create a socket and specify AF_UNIX […]

C language under Linux uses netlink sockets to communicate with the kernel module

Introduction to netlink Netlink socket is a special inter-process communication (IPC) used to communicate between user processes and kernel processes. It is also the most commonly used interface for network applications to communicate with the kernel. In the Linux standard kernel, the system integrates many netlink instances by default, such as log reporting, routing system, […]

Making a Chat Application With Django Channels and Java based on Django Channels framework and JavaScript WebSockets

Author: Zen and the Art of Computer Programming 1. Introduction In this article, we will build a real-time chat system based on the Django Channels framework and JavaScript WebSockets library. This system will enable instant communication between users. The chat room function is powerful and practical. Through this project, you will learn some features of […]

[C++ Network Protocol] Various options for sockets

Table of Contents 1. Socket options 2. Get/set socket options 2.1 getsockopt function (get socket options) 2.2 setsockopt function (set socket options) 3. Common socket options 3.1 SO_TYPE options of SOL_SOCKET protocol layer 3.2 SO_SNDBUF and SO_RCVBUF options of SOL_SOCKET protocol layer 3.3 SO_REUSEADDR option of SOL_SOCKET protocol layer 3.3.1 Time-wait state 3.3.2 SO_REUSEADDR option […]