Remote screen monitoring software system based on JavaGUI

Table of Contents
Abstract…………………………………………………………………11
. Project Analysis……………… ……………………………………2
1.1 Demand analysis
1.2 Feasibility analysis
1.3 Technical point analysis
2. Function realization……………………………… ………………3
2.1 System Tray Module……………………………………………………3
2.1.1 What is the system tray?
2.1.2 Is it necessary to implement system tray?
2.1.3 How to implement system tray
2.1.4 Implement system tray code
2.2 Custom protocol………………………………………………………………5
2.2.1 Network protocol
2.2.2 Why customize the protocol?
2.2.3 Custom protocol
2.2.4 Custom protocol related class description
2.2.5 Core code
2.3 Client module…………………… ………………………………7
2.3.1 Obtain screenshots
2.3.2 Send pictures to the server according to protocol specifications
2.3.3 System exit mechanism
2.3.4 Client code
2.4 Server-side module………… ……………………………………………9
2.4.1 Server logic
2.4.2 Processing of multiple clients
2.4.3 Server-side processing of client message requests

3. Web server environment configuration……………………………………………11
3.1 Brief description
3.2 Tools
3.3 Construction process
3.4 Usage methods
4. Project difficulties………… ……………………………………………………12
4.1 The problem of the client sending pictures in a loop
4.2 Operating JPanel redrawing in the server-side thread
4.3 Handling exceptions
5. Outlook………… …………………………………………………………14
6. Thoughts……………………………………………………………… …………15
Attachment: Software operation renderings…………………………………………16

1. Project Analysis
1.1 Requirements Analysis
The initial stage of the project is to estimate the entire system, which is conducive to our understanding of the entire system. The functions that the screen monitoring system needs to implement are: a.
Client login and exit
b. Client Screen capture and continuous sending of images
c. Client system tray function
d. The server continuously receives images and other requests from the client
e. The server displays the user tree of the connected user
f. The user tree is refreshed after the client exits
g. After the client sends the image Displayed on the server side
1.2 Feasibility Analysis
Can the functions mentioned in the demand analysis be realized? We discuss here:
a. By constructing a custom protocol, these requests are constructed into protocols and sent to the server
b. The screenshot function is implemented through the Robot class, and then the BufferedImage is converted into a byte array output stream, then converted into a byte array, and sent to the server in a protocol to achieve continuous transmission of images.
c. Use the system tray object SystemTray to implement.
d. The data can be parsed out through the data parsing method provided by the custom protocol tool class, and processed accordingly according to the message type.
e. The user tree is implemented using JTree. DefaultTreeCellRenderer can set the appearance of the tree. Set a node selection listener for JTree to listen for node selection events. f.
Use the reload() method of DefaultTreeModel to implement
g. You can customize JPanel through the paint(g) method. Drawing Picture
1.3 Technical Points Analysis
Socket
Two programs on the network exchange data through a two-way communication connection. One end of this connection is called a socket. The Java API provides support for Socket.

Custom network protocol
A network protocol is a collection of rules, standards, or conventions established for the exchange of data in a computer network. In order to meet our needs, we need to customize a protocol and provide it with the function of sending messages and parsing messages.
System Tray
The system tray is a special area, usually at the bottom of the desktop. The project involves some operations on the system tray. We provide the client with the system tray function to facilitate users to turn off monitoring.
IO stream
Stream is an abstract concept that represents the unstructured transfer of data. Input and output are performed in a stream manner, and data is treated as an unstructured byte order or character sequence. The operation of obtaining data from a stream is called an extraction operation, and the operation of adding data to a stream is called an insertion operation. The stream used for input and output operations is called an IO stream. In other words, IO stream is input and output in the form of stream. We mainly use DataOutputStream, DataInputSream, ByteArrayoOutputStream, etc.

package Server;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.HashMap;
import java.util.Map;

public class Server {
    
    
	public Map<String,Socket> client=new HashMap<>();
	public Map<String,Socket> clientManager=new HashMap<>();
	public static void main(String[] args) {
    
    
		try {
    
    
			ServerSocket serverSocket=new ServerSocket(33000);
			Server server=new Server();
			while(true){
    
    
				Socket socket=serverSocket.accept();
				DataInputStream dis=new DataInputStream(socket.getInputStream());
				String power=dis.readUTF();
				String clientKey="client"+socket.getInetAddress().getAddress();
				String managerKey="manager"+socket.getInetAddress().getAddress();
				if(power!=null&&power.equals("client")){
    
    
					if(!server.client.containsKey(clientKey)) server.client.put(clientKey,socket);
					new Thread(new HandleClient(socket)).start();
				}else{
    
    
					if(!server.clientManager.containsKey(managerKey)) server.clientManager.put(managerKey,socket);
					new Thread(new HandleManager(socket)).start();
				}
			}
			
		} catch (IOException e) {
    
    
			e.printStackTrace();
		}
	}
}

Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/newlw/article/details/132706671