5.4 Custom server
5.4.1 Introduce
In order to facilitate the user to solve some of the scenarios in the use of the problem, such as the internal environment, private servers, as well as a variety of complex scenarios, to increase the flexibility of the Power Debugger device, the development of a simplified version of the Power Debugger server, although a simplified version of the Power Debugger remote service, but still need to be developed by the user or the user of the Although it is a simplified version of the Power Debugger remote service, it still requires the user or developer to have some basic knowledge and understanding of the use of the server, and the basic requirements are as follows:
- AMD x64 Linux server, recommending Ubuntu.
- The default TCP and UDP outlets of the Power Debugger server are 3336 port numbers. In addition, the server will obtain the authentication information of the device from the PowerWriter official website through https requests, so you need to release the firewall rules for the corresponding ports to avoid failure of communication.
5.4.2 Entrance
In Hardware Settings, find the function entry of Custom Server, after clicking the Custom Server hyperlink, you will enter the setting page of Custom Server as shown below:
Customized server settings:
- IP Address: Fill in the public IP address of the server.
- TCP Port: Fill in the TCP port of the server.
- UDP Port: Fill in the UDP port of the server.
After filling in the form, click the Test button to test the connectivity of the server, if the connection fails, according to the error message, carry out error troubleshooting, and click the OK button when you are ready.
If a custom server is used, both the transmitting device and the receiving device must be connected to the custom server, otherwise communication is not possible.
5.4.2.1 Test server
#Provide a server already deployed in the Hong Kong region for certain special purposes
IP:43.135.16.231
TCP Port:3336
UDP Port:3336
Test the server, it can be used to assist in verifying the set up server, it can also be used for general purposes, it is not guaranteed that all functions can work normally when accessed from the Internet.
5.4.3 Server Deployment
5.4.3.1 Download
Click on the link to download the Linux AMD64 server powerdebugger_server_mini_linux_amd64.tar
5.4.3.2 Decompression
#Unzip the package
tar -xf ./powerdebugger_server_mini_linux_amd64.tar
#Go to the unzipped directory
cd powerdebugger_server_mini/
5.4.3.3 Start
There are four startup methods, the direct run method is commonly used for testing, the run in the background method is the regular method, which will run in the background when you exit the terminal, the automatic restart method is the monitoring method, which will restart the service automatically when the process exit is detected, and there are also the methods of booting up and adding services.
5.4.3.3.1 Direct Run
#Runs directly with default parameters, default TCP and UDP ports are 3336
./powerdebugger_server_mini
5.4.3.3.2 Run in the background
#The default TCP and UDP ports are 3336.
./powerdebugger_server_mini -d 1
5.4.3.3.4 Automatic restart on abnormal exit
nohup ./start.sh >/dev/null 2>&1 &
5.4.3.3.5 Add boot-up and services
Due to the differences in configuration methods and paths between different Linux distributions and different versions of the same distribution, this document does not provide boot methods or service addition methods, so please consult the relevant information yourself.
5.4.3.4 Check
5.4.3.4.1 Search by port
#The port is the specified server port
netstat -antulpe | grep :port
5.4.3.4.2 Query by process
#Queries whether the process exists
ps aux | grep powerdebugger_server_mini
5.4.3.4.3 Querying through logs
#Query Run Log Information
cat logs/powerdebugger_server.log
5.4.3.5 Stop
5.4.3.5.1 Stop scripts
#Queries if the script is running
ps aux | grep start.sh
#Use killall to terminate basic processes (process IDs), such as
killall -9 sh
5.4.3.5.2 Termination processes
#Force the process to end
killall -9 powerdebugger_server_mini
5.4.3.5.3 Termination services
If the power debugger service has been added, it can be gracefully stopped by stopping the service (the method of configuration varies from system to system; consult your current system manual for details)
sudo service powerdebuggerserver stop
5.4.4 Full parameters
usage:
powerdebugger_server_mini {options}
options:
[-p tcp_port] Specifies the tcp port number. The default is 3336
[-u udp_port] Specifies the udp port number. The default is 3336
[-t thread] Sets the number of worker threads. The default is 6
[-s socket] Set the number of sockets. The default is 1000
[-b buffersize] Set socket buffer size, The default is 4096
[-q queue] Set listen queue,The default is 100
[-m max] Set max connection,The default is 10000
[-d daemon] Daemon process, The default is 1
[-l log] Enable log, The default is 1
[-h help] show help