WO2021143172A1 - 一种端口的管理方法及服务器 - Google Patents

一种端口的管理方法及服务器 Download PDF

Info

Publication number
WO2021143172A1
WO2021143172A1 PCT/CN2020/115486 CN2020115486W WO2021143172A1 WO 2021143172 A1 WO2021143172 A1 WO 2021143172A1 CN 2020115486 W CN2020115486 W CN 2020115486W WO 2021143172 A1 WO2021143172 A1 WO 2021143172A1
Authority
WO
WIPO (PCT)
Prior art keywords
port
server
state
listening
connection
Prior art date
Application number
PCT/CN2020/115486
Other languages
English (en)
French (fr)
Inventor
林万江
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021143172A1 publication Critical patent/WO2021143172A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/554Detecting local intrusion or implementing counter-measures involving event detection and direct action
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures

Definitions

  • the embodiments of the present application relate to the field of communications, in particular to a port management method and server.
  • Socket is an abstraction layer through which applications can send or receive data, and can open, read, write, and close files like files. Sockets allow applications to insert I/O into the network and communicate with other applications on the network. Thus, a computer can communicate with any computer with the local address of the socket through software. The port is the local address of the socket in computer programming.
  • the server When the server communicates with the user equipment through the port, first, the user equipment can communicate with the server only after the server opens the port listening. However, every open listening port is an attack surface.
  • the attacking device can attack the server by attacking the port that should be opened for listening. Therefore, the server should close port listening at an appropriate time according to the needs of the scenario to reduce the attack surface of the system.
  • the server provider can guide users to open or close port listening according to application scenarios through communication matrix, user manual and other materials.
  • large-scale network servers generally have multiple ports, and there are many optional application scenarios.
  • the equipment provider instructs the user to enable or disable port listening for different scenarios through the user manual. This way of managing ports is complicated to operate, and has a high error rate, and the server has poor management capabilities.
  • the embodiment of the present application provides a port management method. After the server sets the first port to the listening state, the server can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the server switches the first port from the listening state to the closed state. The management capability of the server has been improved.
  • the first aspect of the present application provides a communication method.
  • a server obtains information about a first port, where the first port is a port used for communication on the server, and the information about the first port includes the The first port is used to listen for the maximum duration of the connection request; the server sets the first port to a listening state, and the listening state is used to instruct the first port to listen to the connection request sent by the user equipment, The connection request is used to request the server to establish communication with the user equipment; the server obtains the listening duration of the first port; when the listening duration exceeds the first port, it is used to listen to the connection request When the maximum duration of, the server switches the first port from the listening state to the closed state.
  • the server will obtain the information of the first port, and the server will set the first port to the listening state. Then, the server can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the server switches the first port from the listening state to the closed state.
  • This port management method improves the server's management capabilities.
  • the acquiring, by the server, the listening duration of the first port includes: the server periodically acquiring the listening duration of the first port.
  • the server periodically obtains the listening duration of the first port, so as to more accurately confirm whether the listening duration of the first port exceeds the maximum duration of the first port for listening connection requests.
  • This possible implementation improves the accuracy of the server management port.
  • the implementation manner further includes: The first port receives the connection request sent by the user equipment; the server switches the first port from the listening state to the use state according to the connection request; the server receives a connection end instruction; The server sets the state of the first port according to the connection end instruction.
  • the server after the server receives the connection request sent by the user equipment through the first port, the server switches the first port from the listening state to the using state. After the server receives the connection end instruction, the server sets the state of the first port according to the connection end instruction.
  • This possible implementation manner illustrates the operation after the server receives the connection request sent by the user equipment, and improves the feasibility of the solution.
  • the server assigns the first port to the Switching the listening state to the use state includes: the server authenticates the user equipment according to the connection request; if the server confirms that the user equipment passes the authentication, the server transfers the first port The listening state is switched to the use state.
  • the server authenticates the user equipment according to the connection request, and after the user equipment passes the authentication, the server can switch the first port from the listening state to the using state.
  • the server can communicate with the user equipment through the first port in use.
  • the user equipment fails the authentication the first port still remains in the listening state, and no communication connection is established between the server and the user equipment that fails the authentication.
  • This possible implementation ensures that the server communicates with the authenticated user equipment, and improves the security of the server.
  • the first port is The long-connected port
  • the above step: the server setting the state of the first port according to the connection end instruction includes: the server sets the first port to maintain the use state according to the connection end instruction.
  • the server sets the first port to remain in use according to the connection end instruction.
  • the user equipment communicates with the server again according to business requirements, the user equipment can directly establish a communication connection with the server through the first port in use.
  • this possible implementation saves the resources of the server and improves the operating efficiency of the server.
  • the first port is A short connection port
  • the first port is a short connection port
  • the server setting the state of the first port according to the connection end instruction includes: the server sets the first port according to the connection end instruction A port is switched from the use state to the listening state.
  • the server switches the first port from the use state to the listening state according to the connection end instruction.
  • the user equipment needs to establish a communication connection with the user equipment again according to service requirements
  • the user equipment needs to send a connection request to the server again, and the server establishes a communication connection with the user equipment according to the connection request.
  • the server will obtain the listening duration of the first port.
  • the listening duration exceeds the maximum duration for the first port to listen for connection requests, The server switches the first port from the listening state to the closed state.
  • the first port is a long connection port
  • the The implementation method further includes: the server receives a first switching instruction, the first switching instruction is used to instruct the server to switch from the commissioning state to the normal state; the server starts timing according to the first switching instruction, the The timing is used to instruct the server to record the listening time of the first port.
  • the server system has two states. One is the commissioning state and the other is the normal state.
  • the commissioning state When the server just leaves the factory, the server's system is defaulted to the commissioning state.
  • the operator will configure the server according to the business requirements between the server and the user equipment. At this time, the state of the server being configured is called the commissioning state.
  • the commissioning state After the operator completes the commissioning of the server, the operator can switch the server from the commissioning state to the normal state.
  • the normal state is the state after the server is officially working.
  • the server receives the first switching instruction, the server switches the commissioning state to the normal state.
  • the server starts timing on the first port in the listening state according to the first switching instruction, and records the listening duration of the first port.
  • the first port is a short connection port
  • the implementation manner further includes: the server receives a second switching instruction; the server acquiring the information of the first port includes: the server acquires the information according to the second switching instruction Information about the first port.
  • the first port is a short connection port.
  • the server After the server receives the second switching instruction, the server obtains the listening information of the first port according to the second switching instruction, and then sets the first port to the listening state .
  • the server sets the first port to the listening state after receiving the second switching instruction.
  • the server receiving the second switching instruction includes: the server passes the second The port receives the second switching instruction, and the second port is in the use state.
  • the server receives the second switching instruction through the second port. This possible implementation manner improves the feasibility of the solution.
  • the second aspect of the present application provides a server, which is configured to execute the foregoing first aspect or any possible implementation of the first aspect.
  • the server includes a module or unit for executing the foregoing first aspect or any possible implementation of the first aspect.
  • a third aspect of the present application provides a server, which includes at least one processor, a memory, and a communication interface.
  • the processor is coupled with the memory and the communication interface.
  • the memory is used to store instructions
  • the processor is used to execute the instructions
  • the communication interface is used to communicate with other user equipment under the control of the processor.
  • the processor executes the method in the first aspect or any possible implementation manner of the first aspect.
  • the fourth aspect of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a program, and the program enables a server to execute the method in the first aspect or any possible implementation of the first aspect.
  • the fifth aspect of the present application provides a computer program product storing one or more computer-executable instructions.
  • the processor executes any one of the first aspect or the first aspect. Ways of possible implementation.
  • the server will obtain the information of the first port, and the server will set the first port to the listening state. Then, the server can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the server switches the first port from the listening state to the closed state.
  • This port management method improves the management capabilities of the server.
  • FIG. 1 is a schematic diagram of an application scenario of a port management system provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 4 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 7 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • Figure 8a is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a structure of a server provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of another structure of a server provided by an embodiment of the present application.
  • Large web servers generally have multiple ports. Since the user equipment needs to jointly carry out a certain business with the server, the user equipment needs to establish a communication connection with the server through a port on the server. After the server sets the port corresponding to the service to the listening state, the server can receive the connection request sent by the user equipment through the port in the listening state. However, every port in the listening state is an attack surface. The attacking device can attack the server by attacking the port in the listening state. Therefore, the server should switch the port from the listening state to the closed state at an appropriate time according to the needs of the business. The equipment provider can guide the user through the user manual to switch the port from the listening state to the closed state for different needs. This port management method is complicated to operate, and the error rate is high, and the server management capability is poor.
  • embodiments of the present application provide a port management method and a server, which can improve the management capability of the server.
  • Fig. 1 is a schematic diagram of an application scenario of a port management system provided by an embodiment of the present application.
  • the port management system provided by the embodiment of the present application includes: a server 101, access network devices 102 and 103, and user devices 104, 105, and 106.
  • the user equipment 104 communicates with the server 101 through the access network equipment 102, and the user equipment 105 and the user equipment 106 communicate with the server 101 through the access network equipment 103.
  • the application scenarios of the embodiments of the present application may include multiple servers, and more or fewer access network devices and user equipment.
  • a server is a type of computer that provides computing or application services for user equipment in the network.
  • the processor included in the server has powerful computing power, can achieve long-term reliable operation, and has powerful I/O external data throughput and good scalability.
  • the server According to the services provided by the server, in general, the server has the ability to respond to service requests, undertake services, and guarantee services.
  • the server mentioned in the embodiment of the present application may be a telecommunication equipment gateway server, may be an Internet technology (IT) server, or may be another type of server, which is not specifically limited here.
  • IT Internet technology
  • the user equipment may be a smart phone, the user equipment may also be a personal computer (PC), and the user equipment may also be other equipment, which is not specifically limited here.
  • PC personal computer
  • the server and the access network device and the access network device and the user equipment are generally connected through a wireless network, and of course, can also be connected through a wired network. If it is connected through a wireless network, the specific connection form may be a cellular wireless network, or a WiFi network, or another type of wireless network, which is not specifically limited here.
  • the server and the access network device and the access network device and the user equipment are generally connected through a wireless network, and of course, can also be connected through a wired network. If it is connected through a wired network, the general form of connection is an optical fiber network.
  • the user equipment when the user equipment needs to jointly develop a certain service with the server, the user equipment will send a connection request to the server through the access network device.
  • the port corresponding to the service in the server can receive the connection request, and establish a communication connection with the user equipment according to the connection request.
  • a server has multiple network cards, and a network card has multiple Internet Protocol (IP) addresses.
  • IP Internet Protocol
  • One IP address corresponds to 65,535 ports.
  • the combination of a port number and an IP address forms a port for communication with the outside world.
  • the local address of the socket, and the port is the local address of the socket in computer programming.
  • an embodiment of the port management method in the embodiment of the present application includes step 201 to step 204.
  • the server obtains the information of the first port, where the information of the first port includes the maximum duration for the first port to listen for connection requests.
  • the server has multiple ports.
  • the server can carry out different services with different user equipment, and there is a corresponding relationship between services and ports, and the first port is one of multiple ports on the server.
  • a port number and an IP address are combined to form a socket local address for communication with the outside world.
  • the port is the socket local address in computer programming.
  • the server may create the socket local address according to the port number and the IP address.
  • the local address of the socket is the first port.
  • FIG. 3 is a schematic diagram of an embodiment of a port management method provided by an embodiment of the present application.
  • the port mentioned in the embodiment of the present application can be in a listening state, a used state, and a closed state.
  • the port being in the listening state indicates that the server listens to the connection request sent by the user equipment through the port.
  • the port in use state indicates that the server communicates with the user equipment through the port, and the port in the closed state indicates that the server cannot receive connection requests sent by the user equipment through the port and the user equipment cannot communicate with the user equipment through the port.
  • the information about the first port may include the maximum duration for the first port to listen for connection requests, the information about the first port may also include the port number and IP address of the first port, and the information about the first port may also include Other parameters related to the first port are not specifically limited here.
  • the server sets the first port to a listening state.
  • the listening state is used to indicate that the first port listens to the connection request sent by the user equipment, and the connection request is used to request the server to establish communication with the user equipment.
  • the server sets the first port to the listening state by calling the listen function in the application programming interface (API) function related to the first port. Furthermore, the server can set the first port to the listening state through The first port listens to the connection request sent by the user equipment.
  • API application programming interface
  • the server obtains the listening duration of the first port.
  • the server after the server sets the first port to the listening state, the server will start the timer module, which can record the listening duration of the first port, and the listening duration of the first port is The length of time after the first port is set to the listening state.
  • the server switches the first port from the listening state to the closed state.
  • the server will obtain the information of the first port, and the server will set the first port to the listening state. Then, the server can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the server switches the first port from the listening state to the closed state.
  • This port management method has a low error rate, high accuracy, saves human resources, and has strong server management capabilities.
  • the server mentioned in step 203 in the embodiment of the present application has a specific implementation manner for obtaining the listening duration of the first port, and the specific implementation manner will be described in the following embodiments.
  • the server periodically obtains the listening duration of the first port.
  • Fig. 4 is a schematic diagram of an embodiment of a port management method provided by an embodiment of the present application.
  • the server includes port management software
  • the port management software includes a port management module, a port module, and a timer module.
  • the server presets the timing sending duration, and the timer module included in the port management system will periodically send a timing check message to the port management module according to the timing sending duration. After receiving the timing check message, the port management module will obtain the first The listening duration of the port.
  • the first timer periodically sends the timing check message to the port management module according to the timing transmission duration as an example for description.
  • Other implementation manners are also possible, which are not specifically limited here.
  • the server mentioned in step 203 in the embodiment of this application obtains the listening duration of the first port, which is an operation performed when the user equipment does not access the server through the first port.
  • the server accesses the server through the first port, the server The operations performed will be described in detail in the following embodiments.
  • an embodiment of the port management method in the embodiment of the present application includes step 301 to step 305.
  • the server receives a connection request sent by a user equipment through a first port.
  • the server will call the isten function related to the first port, thereby setting the first port to the listening state.
  • the server may receive the connection request sent by the user equipment through the first port in the listening state.
  • the server authenticates the user equipment according to the connection request.
  • the server after the user equipment sends a connection request to the server through the first port, the server will call the accept function in the API function corresponding to the first port to accept the connection request sent by the user equipment.
  • the connection request authenticates the user equipment.
  • the server may determine whether the connection request includes an authentication certificate.
  • the authentication certificate is used to indicate that the user equipment is qualified to establish a communication connection with the server. If the connection request includes the authentication certificate, the user equipment can pass the authentication of the server. If the connection request does not include the authentication certificate, the user equipment cannot pass the authentication of the server.
  • the server can obtain the IP address of the user equipment and the port number of the user equipment contained in the connection request, and the server sends the information according to the IP address of the user equipment and the port number of the user equipment.
  • the user device sends a login request. After the user equipment receives the login request and the user equipment successfully logs in, the user equipment can pass the authentication of the server. If the user equipment fails to log in, the user equipment cannot pass the authentication of the server.
  • the manner in which the server can determine whether the connection request includes an authentication certificate, and the manner in which the server sends a login request to the user equipment according to the IP address of the user equipment and the port number of the user equipment are taken as an example for description.
  • the server can also authenticate the user equipment through other authentication methods, which are not specifically limited here.
  • the server switches the first port from the listening state to the using state.
  • the server after confirming that the user equipment passes the authentication, the server creates a connected socket according to the connection request, and further, the server can communicate with the user equipment through the connected socket.
  • the first port is switched from the listening state to the in-use state.
  • the server receives the connection end instruction.
  • the server and the user equipment no longer send messages to each other.
  • the server will then receive the connection end command.
  • the server sets the state of the first port according to the connection end instruction.
  • the first port mentioned in step 305 in the embodiment of the present application has different categories.
  • the first port may be a long connection port, and the first port may also be a short connection port, which will be described separately below.
  • the port used for communication between the server and the user equipment in a long connection mode is a long connection port.
  • connection maintenance period if no data packets are sent, both parties need to send link detection packets.
  • the server When the server and the user equipment jointly carry out a certain service, the server establishes a communication connection with the user equipment through the first port. According to service requirements, the server frequently sends messages to the user equipment through the first port, or the server frequently receives messages sent by the user equipment through the first port, the server may set the first port as a persistent connection port.
  • the port used for communication between the server and the user equipment in a short connection mode is the short connection port.
  • Short connection means that when the two parties in communication have data interaction, a connection is established, and after the data transmission is completed, the connection is disconnected, that is, only one service is sent for each connection.
  • the equipment provider Before the server leaves the factory, the equipment provider will set the port type according to the business connection needs.
  • the user equipment and the server jointly carry out the A service. If the A service requires frequent communication connections between the user equipment and the server, the equipment provider can configure the port corresponding to the A service as a long connection port. According to the requirements of the A service, when the frequency of establishing a communication connection between the user equipment and the server is low, the equipment provider can configure the port corresponding to the A service as a short connection port.
  • http services of websites like the worldwide web (WEB) generally communicate in the form of short links. Because long connections will consume a certain amount of resources for the server, and for the frequent connections of thousands or even hundreds of millions of clients like the WEB website, the use of short connections for communication will save the resources of the WEB server. If thousands of users use long connections to establish communication with the WEB server, each user occupies a connection channel, which will greatly occupy the resources of the server and reduce the operating efficiency of the server.
  • the server mentioned in step 305 has a specific implementation manner for setting the state of the first port according to the connection end instruction, and the specific implementation manner will be described in detail below.
  • the communication between the server and the user equipment is relatively frequent.
  • the server will receive a connection end instruction, and the server can set the first port to remain in use according to the connection end instruction.
  • the user equipment can directly establish communication with the server through the first port in use.
  • the server mentioned in step 305 has a specific implementation manner for setting the state of the first port according to the connection end instruction, and the specific implementation manner will be described in detail below.
  • the communication frequency between the server and the user equipment is low.
  • the server will receive the connection end instruction, and the port management module included in the server can set the first port to the listening state according to the connection end instruction.
  • the first port in the listening state will continue to listen to the connection request sent by the user equipment.
  • the port management module included in the server will continue to obtain the listening duration of the first port.
  • the listening duration exceeds the maximum duration of the first port for listening to connection requests, no user equipment has sent a connection to the server through the first port.
  • the port management module switches the first port from the listening state to the closed state.
  • the first port mentioned in step 201 to step 204 in the embodiment of the present application has different categories.
  • the first port may be a long connection port, and the first port may also be a short connection port, which will be described separately below.
  • the first port is a long connection port.
  • the server mentioned in the embodiment of the present application has two different states.
  • the optional server can be in the commissioning state, and the server can also be in the normal state, which will be described in detail below.
  • the server mentioned in step 201 obtains the information of the first port and the server mentioned in step 202 sets the first port to the listening state.
  • the server mentioned in step 201 obtains the information of the first port and the server mentioned in step 202 sets the first port to the listening state.
  • the server mentioned in step 203 obtains the listening duration of the first port, and when the listening duration mentioned in step 204 exceeds the maximum duration of the first port for listening to connection requests, the server There is a specific implementation manner for switching the first port from the listening state to the closed state, and the specific implementation manner will be described in detail below.
  • an embodiment of the port management method in the embodiment of the present application includes steps 401 to 406.
  • the server obtains the information of the first port, where the information of the first port includes the maximum duration for which the first port is used to listen for connection requests.
  • FIG. 7 is a schematic diagram of an embodiment of a port management method provided by an embodiment of the present application.
  • the system of the server when the server is just shipped from the factory, the system of the server is defaulted to the commissioning state.
  • the operator will configure the server according to the business requirements between the server and the user equipment.
  • the state of the server being configured is called the commissioning state.
  • the port management module included in the server in the commissioning state will obtain the information of all the persistent connection ports of the server, and the first port is one of all the persistent connection ports in the server.
  • the server sets the first port to a listening state.
  • the first port is one of the persistent connection ports.
  • the port management module in the server sends a listening instruction to the port module, and the port module sets all persistent connection ports to the listening state according to the listening instruction.
  • the user equipment may send a connection request to the persistent connection port in the listening state.
  • the server receives the first switching instruction.
  • the operator after the operator completes the commissioning of the server, the operator can switch the server from the commissioning state to the normal state.
  • the first switching instruction may instruct the server to switch from the commissioning state to the normal state.
  • the server may receive the first switching instruction issued by the operator on the operation panel. After receiving the first switching instruction, the port management module included in the server will switch the server from the commissioning state according to the first switching instruction. It is normal.
  • the server can preset the maximum commissioning duration, and the maximum commissioning duration is the maximum duration of the server in the commissioning state.
  • the timer module included in the server will record the time the server is in the commissioning state. When the timer module confirms that the server is in the commissioning state for more than the maximum time of the commissioning, the timer module in the server will send a message to the port management module. Timeout information, the timeout information is the first switching instruction, and the port management module can switch the server from the commissioning state to the normal state according to the first switching instruction.
  • the server can preset the maximum commissioning duration, and the maximum commissioning duration is the maximum duration of the server in the commissioning state.
  • the timer module included in the server will record the time the server is in the commissioning state. When the timer module confirms that the server is in the commissioning state for more than the maximum time of the commissioning, the timer module in the server will send a message to the port management module. Timeout information. The timeout information is used to remind the operator that the time that the server is in the commissioning state exceeds the maximum commissioning time, and the operator executes the first switching instruction on the operation panel according to the timeout reminder information.
  • the port management module switches the server from the commissioning state to the normal state according to the first switching instruction. If the operator thinks that the server still needs to be configured, the operator can ignore the timeout information and not execute the first handover instruction.
  • the operator executes the first switching instruction on the operation panel, and the port management module included in the server switches the server from the commissioning state to the normal state according to the first switching instruction, and the timer in the server
  • the module sends the first switching instruction to the port management module, and the port management module included in the server switches the server from the commissioning state to the normal state according to the first switching instruction as an example for description. It is understandable that there may also be other switching methods, which are not specifically limited here.
  • the server starts timing according to the first switching instruction.
  • the port management module included in the server connection receives the first switching instruction
  • the port management module in the server will send a timer
  • the module sends a start timing command.
  • the first port is one of all persistent connection ports in the listening state in the server.
  • the timer module receives the start timing instruction, it will start timing on all persistent connection ports in the listening state in the server.
  • the server obtains the listening duration of the first port.
  • the timer module in the server will periodically send timing check messages to the port management module. After receiving the timing check message, the port management module obtains the listening duration of the first port from the timer module.
  • the server switches the first port from the listening state to the closed state.
  • the port management module included in the server connection will determine whether the listening duration exceeds the maximum duration of the first port for listening to the connection request.
  • the port management module confirms that the listening duration exceeds the maximum duration for the first port to listen for connection requests, the port management module will send a shutdown instruction to the port module, and the port module will switch the first port from the listening state to closed according to the shutdown instruction state.
  • the first port is a short connection port.
  • an embodiment of the port management method in the embodiment of the present application includes step 501 to step 506.
  • the server receives a second switching instruction.
  • Fig. 8a is a schematic diagram of another embodiment of a port management method provided by an embodiment of the present application.
  • the second switching instruction is used to instruct the server to set the first port to the listening state.
  • the server obtains the information of the first port according to the second switching instruction.
  • the first port is a short connection port.
  • the port management module included in the server will receive the second switching instruction.
  • the second switching instruction includes a port number corresponding to the first port and an IP address corresponding to the first port.
  • the port management module obtains the information of the first port according to the port number corresponding to the first port and the IP address corresponding to the first port included in the second switching instruction.
  • the operator executes the second switching instruction on the operation panel of the server.
  • the port management module included in the server obtains the information of the first port according to the second switching instruction.
  • the second port when the user equipment establishes a communication connection with the server through the second port, the second port is in use.
  • the user equipment may send a second switching instruction to the server through the second port.
  • the port management module included in the server After receiving the second switching instruction, the port management module included in the server will obtain the information of the first port according to the second switching instruction.
  • the operator executes the second switching instruction on the operation panel of the server and the user equipment sends the second switching instruction to the server through the second port as an example for description.
  • the server may also receive it in other ways.
  • the second switching instruction is not specifically limited here.
  • the server sets the first port to a listening state.
  • the port management module in the server determines whether the first port is in the listening state. If the port management module confirms that the first port is already in the listening state, the port management module in the server does not send to the port module Listen for instructions. If the port management module confirms that the first port is in the closed state, the port management module sends a listening instruction to the port module, and the port module sets the first port to the listening state. After the port module sets the first port to the listening state, the port management module sends a start timing instruction to the timer module, and the timer module starts timing according to the start timing instruction.
  • the server obtains the listening duration of the first port.
  • step 504 is similar to step 405 in the foregoing embodiment, and the details are not described here.
  • the server switches the first port from the listening state to the closed state.
  • step 505 is similar to step 406 in the foregoing embodiment, and details are not described here.
  • the server will obtain the information of the first port, and the server will set the first port to the listening state. Then, the server can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the server switches the first port from the listening state to the closed state.
  • This port management method improves the management capabilities of the server.
  • the foregoing embodiment provides different implementations of a port management method.
  • the following provides a server 60.
  • the server 60 is configured to execute the steps executed by the server in the foregoing embodiment.
  • the server 60 includes:
  • the processing unit 601 is used to:
  • Acquiring information about a first port where the first port is a port used for communication on the server, and the information about the first port includes the maximum duration for which the first port is used to listen for connection requests;
  • the first port is set to a listening state, the listening state is used to instruct the first port to listen to a connection request sent by a user equipment, and the connection request is used to request the server to establish a connection with the user equipment Communication
  • the processing unit 601 switches the first port from the listening state to a closed state.
  • processing unit 601 the processing unit 601:
  • a receiving unit configured to receive the connection request sent by the user equipment through the first port
  • the processing unit 601 is further configured to switch the first port from the listening state to the use state according to the connection request;
  • the receiving unit is also used to receive a connection end instruction
  • the processing unit 601 is further configured to set the state of the first port according to the connection end instruction.
  • the processing unit 601 is configured to authenticate the user equipment according to the connection request
  • the processing unit 601 If the processing unit 601 confirms that the user equipment passes the authentication, the processing unit 601 switches the first port from the listening state to the use state.
  • the first port is a long connection port
  • the processing unit 601 is configured to set the first port to maintain the use state according to the connection end instruction.
  • the first port is a short connection port
  • the processing unit 601 is configured to switch the first port from the use state to the listening state according to the connection end instruction.
  • the first port is a long connection port
  • the receiving unit is configured to receive a first switching instruction, where the first switching instruction is used to instruct the server to switch from a commissioning state to a normal state;
  • the processing unit 601 is configured to start timing according to the first switching instruction, and the timing is used to instruct the processing unit 601 to record the listening duration of the first port.
  • the receiving unit is further configured to receive a second switching instruction
  • the processing unit 601 is further configured to obtain information of the first port according to the second switching instruction.
  • the receiving unit is configured to receive the second switching instruction through a second port, and the second port is in the use state.
  • the server 700 includes a processor 702, a communication interface 703, a memory 701, and a bus 704. Among them, the communication interface 703, the processor 702, and the memory 701 are connected to each other through a bus 704; the bus 704 may be a Peripheral Component Interconnect (PCI) bus or an extended industry standard architecture (EISA) bus Wait.
  • PCI Peripheral Component Interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used to represent in FIG. 10, but it does not mean that there is only one bus or one type of bus.
  • the server 700 can implement the function of the server in the embodiment shown in FIG. 9.
  • the processor 702 and the communication interface 703 can perform the corresponding functions of the server in the foregoing method example.
  • the memory 701 may be a volatile memory (volatile memory), such as a random-access memory (random-access memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (read-only memory).
  • volatile memory such as a random-access memory (random-access memory, RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (read-only memory).
  • memory ROM), flash memory (flash memory), hard disk drive (HDD) or solid-state drive (SSD); or a combination of the above types of memory, used to store materials that can implement the method of this application Program code, configuration files or other content.
  • the processor 702 is the control center of the controller, and it can be a central processing unit (CPU), an application specific integrated circuit (ASIC), or it can be configured to implement the embodiments of this application.
  • One or more integrated circuits such as one or more digital signal processors (digital signal processors, DSP), or one or more field programmable gate arrays (FPGA).
  • the communication interface 703 is used to communicate with other user equipment.
  • the communication interface 703 is configured to receive a connection request sent by the user equipment through the first port.
  • the communication interface 703 is used to receive a connection end instruction.
  • the communication interface 703 is used to receive the second switching instruction.
  • the communication interface 703 is configured to receive the second switching instruction through the second port, and the second port is in use.
  • the processor 702 can perform operations performed by the server in the embodiment shown in FIG. 9, and details are not described herein again.
  • the processor 702 executes the following functions by running or executing software programs and/or modules stored in the memory 701, and calling data stored in the memory 701:
  • the processor After the processor sets the first port to the listening state, the processor can obtain the listening duration of the first port. When the listening duration exceeds the maximum duration of the first port for listening to the connection request, the processor switches the first port from the listening state to the closed state. The management capability of the server has been improved.
  • the present application also provides a chip system, which includes a processor, and is used to support the aforementioned forwarding device or control device to realize its related functions, for example, to receive or process the messages and /Or information.
  • the chip system further includes a memory, and the memory is used to store necessary program instructions and data of the computer equipment.
  • the chip system can be composed of chips, or include chips and other discrete devices.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • wired such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

一种端口的管理方法,应用于具有多个端口的大型网络服务器。该方法包括:首先,服务器会获取第一端口的信息,服务器将第一端口设置为侦听状态。然后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。这样的端口管理方式提升了服务器的管理能力。

Description

一种端口的管理方法及服务器
本申请要求于2020年1月17日提交中国国家知识产权局、申请号为202010054472.0、发明名称为“一种端口的管理方法及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及通信领域,尤其是一种端口的管理方法及服务器。
背景技术
套接字(socket)是一个抽象层,应用程序可以通过它发送或接收数据,可对其进行像对文件一样的打开、读写和关闭等操作。套接字允许应用程序将I/O插入到网络中,并与网络中的其他应用程序进行通信。从而,一台计算机就可以通过软件的方式与任何一台具有socket本端地址的计算机进行通信。端口(port)在计算机编程上也就是socket本端地址。
当服务器通过端口与用户设备进行通信连接时,首先,服务器开启端口侦听之后,用户设备才能与服务器进行通信连接。然而,每一个开启侦听的端口都是一个攻击面(attack surface)。攻击设备可以通过攻击该开启侦听的端口来攻击服务器。因此,服务器应当根据场景的需要在合适的时间关闭端口侦听,以减少系统的攻击面。服务器提供商可以通过通信矩阵、用户手册等资料指导用户根据应用场景开启或者关闭端口侦听。
然而,大型网络服务器一般都具有多个端口,可选应用场景较多。设备提供商通过用户手册指导用户针对不同的场景开启或者关闭端口侦听。这种管理端口的方式操作复杂,且出错率高,服务器的管理能力差。
发明内容
本申请实施例提供了一种端口的管理方法,服务器将第一端口设置为侦听状态之后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。服务器的管理能力得到了提升。
本申请第一方面提供一种通信方法,在该方法中:服务器获取第一端口的信息,所述第一端口为所述服务器上用于通信的端口,所述第一端口的信息包括所述第一端口用于侦听连接请求的最大时长;所述服务器将所述第一端口设置为侦听状态,所述侦听状态用于指示所述第一端口侦听用户设备发送的连接请求,所述连接请求用于请求所述服务器与所述用户设备建立通信;所述服务器获取所述第一端口的侦听时长;当所述侦听时长超过所述第一端口用于侦听连接请求的最大时长时,所述服务器将所述第一端口由所述侦听状态切换为关闭状态。
本申请实施例中,首先,服务器会获取第一端口的信息,服务器将第一端口设置为侦听状态。然后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。这样的端口管理 方式提升了服务器的管理能力。
基于本申请实施例第一方面,本申请实施例第一方面的第一种实现方式中,上述步骤:
所述服务器获取所述第一端口的侦听时长,包括:所述服务器周期性地获取所述第一端口的侦听时长。
该种可能的实现方式中,服务器周期性地获取第一端口的侦听时长,以便于更加准确地确认第一端口的侦听时长是否超过第一端口用于侦听连接请求的最大时长,该种可能的实现方式提升了服务器管理端口的准确性。
基于本申请实施例第一方面或本申请实施例第一方面的第一种实现方式,本申请实施例第一方面的第二种实现方式中,所述实现方式还包括:所述服务器通过所述第一端口接收所述用户设备发送的所述连接请求;所述服务器根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态;所述服务器接收连接结束指令;所述服务器根据所述连接结束指令设置所述第一端口的状态。
该种可能的实现方式中,服务器通过第一端口接收到用户设备发送的连接请求之后,服务器将第一端口由侦听状态切换为使用状态。服务器接收到连接结束指令之后,服务器根据连接结束指令设置第一端口的状态。该种可能的实现方式说明了服务器接收到用户设备发送的连接请求之后的操作,提升了方案的可实现性。
基于本申请实施例第一方面的第二种实现方式,本申请实施例第一方面的第三种实现方式中,上述步骤:所述服务器根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态,包括:所述服务器根据所述连接请求对所述用户设备鉴权;若所述服务器确认所述用户设备通过鉴权,则所述服务器将所述第一端口由所述侦听状态切换为所述使用状态。
该种可能的实现方式中,服务器根据连接请求对用户设备鉴权,当用户设备通过鉴权之后,服务器可以将第一端口由侦听状态切换为使用状态。服务器可以通过处于使用状态的第一端口与用户设备进行通信。当用户设备未通过鉴权,则第一端口任然保持侦听状态,服务器与未通过鉴权的用户设备之间不建立通信连接。该种可能的实现方式确保服务器与通过鉴权的用户设备进行通信,提升了服务器的安全性。
基于本申请实施例第一方面的第二种实现方式或本申请实施例第一方面的第三种实现方式,本申请实施例第一方面的第四种实现方式中,所述第一端口为长连接端口,上述步骤:所述服务器根据所述连接结束指令设置所述第一端口的状态,包括:所述服务器根据所述连接结束指令设置所述第一端口保持所述使用状态。
该种可能的实现方式中,当第一端口为长连接端口时,服务器根据连接结束指令设置第一端口保持使用状态。当用户设备根据业务需求再次与服务器进行通信时,用户设备可以直接通过处于使用状态的第一端口与服务器建立通信连接。当用户设备需要频繁连接服务器时,该种可能的实现方式节约了服务器的资源,提升了服务器的运行效率。
基于本申请实施例第一方面的第二种实现方式或本申请实施例第一方面的第三种实现方式,本申请实施例第一方面的第五种实现方式中,所述第一端口为短连接端口,所述第一端口为短连接端口,上述步骤:所述服务器根据所述连接结束指令设置所述第一端口的状态,包括:所述服务器根据所述连接结束指令将所述第一端口由所述使用状态切换为所 述侦听状态。
该种可能的实现方式中,当第一端口为短连接端口时,当用户设备与服务器通过第一端口通信结束之后,服务器根据连接结束指令将第一端口由使用状态切换为侦听状态。用户设备根据业务的需求需要与用户设备再次建立通信连接时,用户设备需要再次向服务器发送连接请求,服务器根据该连接请求与用户设备建立通信连接。服务器根据连接结束指令将第一端口由使用状态切换为侦听状态之后,服务器将会获取第一端口的侦听时长,当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。当用户设备不需要频繁连接服务器时,该种可能的实现方式节约了服务器的资源,提升了服务器的运行效率。
基于本申请实施例第一方面至本申请实施例第一方面的第四种实现方式,本申请实施例第一方面的第六种实现方式中,所述第一端口为长连接端口,所述实现方式还包括:所述服务器接收第一切换指令,所述第一切换指令用于指示所述服务器由调测态切换为正常态;所述服务器根据所述第一切换指令启动计时,所述计时用于指示所述服务器记录所述第一端口的侦听时间。
该种可能的实现方式中,第一端口为长连接端口时,服务器的系统具有两种状态。一种是调测态,一种是正常态。服务器刚出厂时,服务器的系统被默认为调测态。运营商将会根据服务器与用户设备之间的业务需求来配置服务器。此时,服务器处于被配置的状态则被称为调测态。当运营商完成服务器的调测之后,运营商可以将服务器由调测态切换为正常态。正常态是服务器正式工作之后的状态。服务器接收到第一切换指令之后,服务器将调测态切换为正常态。服务器根据第一切换指令对处于侦听状态的第一端口启动计时,记录第一端口的侦听时长。
基于本申请实施例第一方面以及至本申请实施例第一方面的第一种、第二种、第三种、第五种实现方式,本申请实施例第一方面的第七种实现方式中,所述第一端口为短连接端口,所述实现方式还包括:所述服务器接收第二切换指令;服务器获取第一端口的信息,包括:所述服务器根据所述第二切换指令获取所述第一端口的信息。
该种可能的实现方式中,第一端口为短连接端口,服务器接收第二切换指令之后,服务器根据第二切换指令获取第一端口的侦听信息,然后再将第一端口设置为侦听状态。当用户设备连接服务器的频率较低时,服务器在接收到第二切换指令之后才将第一端口设置为侦听状态,该种可能的实现方式节约了服务器的资源,提升了服务器的运行效率。
基于本申请实施例第一方面的第七种实现方式,本申请实施例第一方面的第八种实现方式中,上述步骤:所述服务器接收第二切换指令,包括:所述服务器通过第二端口接收所述第二切换指令,所述第二端口处于所述使用状态。
该种可能的实现方式中,服务器通过第二端口接收第二切换指令,该种可能的实现方式提升了方案的可实现性。
本申请第二方面提供一种服务器,用于执行上述第一方面或第一方面的任意可能的实现方式中的方法。具体地,该服务器包括用于执行上述第一方面或第一方面的任意可能的实现方式中的方法的模块或单元。
本申请第三方面提供一种服务器,该服务器包括至少一个处理器、存储器和通信接口。 处理器与存储器和通信接口耦合。存储器用于存储指令,处理器用于执行该指令,通信接口用于在处理器的控制下与其他用户设备进行通信。该指令在被处理器执行时,使处理器执行第一方面或第一方面的任意可能的实现方式中的方法。
本申请第四方面提供了一种计算机可读存储介质,该计算机可读存储介质存储有程序,该程序使得服务器执行上述第一方面或第一方面的任意可能的实现方式中的方法。
本申请第五方面提供一种存储一个或多个计算机执行指令的计算机程序产品,当所述计算机执行指令被所述处理器执行时,所述处理器执行上述第一方面或第一方面任意一种可能实现方式的方法。
从以上技术方案可以看出,本申请实施例具有以下优点:
本申请实施例中,首先,服务器会获取第一端口的信息,服务器将第一端口设置为侦听状态。然后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。这样的端口管理方式提升了服务器的管理能力。
附图说明
图1是本申请实施例提供的端口的管理系统的应用场景示意图;
图2是本申请实施例提供的端口的管理方法的一实施例示意图;
图3是本申请实施例提供的端口的管理方法的另一实施例示意图;
图4是本申请实施例提供的端口的管理方法的另一实施例示意图;
图5是本申请实施例提供的端口的管理方法的另一实施例示意图;
图6是本申请实施例提供的端口的管理方法的另一实施例示意图;
图7是本申请实施例提供的端口的管理方法的另一实施例示意图;
图8是本申请实施例提供的端口的管理方法的另一实施例示意图;
图8a是本申请实施例提供的端口的管理方法的另一实施例示意图;
图9是本申请实施例提供的服务器的一结构示意图;
图10是本申请实施例提供的服务器的另一结构示意图。
具体实施方式
下面结合附图,对本申请的实施例进行描述,本领域普通技术人员可知,随着技术的发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。
大型网络服务器一般都具有多个端口。由于用户设备要与服务器共同开展某项业务,用户设备需要通过服务器上的端口与服务器建立通信连接。服务器将与业务相对应的端口设置为侦听状态后,服务器可以通过处于侦听状态的端口接收用户设备发送的连接请求。然而,每一个处于侦听状态的端口都是一个攻击面。攻击设备可以通过攻击处于侦听状态的端口来攻击服务器。因此,服务器应当根据业务的需要在合适的时间将端口由侦听状态 切换为关闭状态。设备提供商可以通过用户手册指导用户针对不同的需要将端口由侦听状态切换为关闭状态。这种端口的管理方式操作复杂,且出错率高,服务器的管理能力差。
针对现有的端口的管理方式存在的上述问题,本申请实施例提供了一种端口的管理方法以及服务器,能够提升服务器的管理能力。
图1是本申请实施例提供的端口的管理系统的应用场景示意图。
请参阅图1,本申请实施例提供的端口的管理系统包括:服务器101,接入网设备102以及103,用户设备104、105以及106。
其中,用户设备104通过接入网设备102与服务器101进行通信连接,用户设备105以及用户设备106通过接入网设备103与服务器101进行通信连接。
本申请实施例中,仅以一个服务器101和两个接入网设备102以及103和三个用户设备104、105以及106为例进行说明。在实际应用中,可选的,本申请实施例的应用场景中可以包括多个服务器,以及更多或者更少的接入网设备和用户设备。
服务器是计算机的一种,在网络中为用户设备提供计算或者应用服务。服务器中包括的处理器具有强大的运算能力,能够实现长时间的可靠运行,并且具有强大的I/O外部数据吞吐能力以及良好的扩展性。根据服务器所提供的服务,一般来说服务器都具备承担响应服务请求、承担服务、保障服务的能力。
可选的,本申请实施例中所提及的服务器可以是电信设备网关服务器,可以是互联网技术(internet technology,IT)服务器,还可以是其他类型的服务器,具体此处不做限定。
可选的,用户设备可以是智能手机,用户设备还可以是个人计算机(personal computer,PC),用户设备还可以是其他设备,具体此处不做限定。
可选的,服务器与接入网设备以及接入网设备与用户设备之间一般通过无线网络连接,当然也可以通过有线网络连接。如果是通过无线网络连接,具体的连接形式可以为蜂窝状无线网络,或者是WiFi网络,或者是其他类型的无线网络,具体此处不做限定。
可选的,服务器与接入网设备以及接入网设备与用户设备之间一般通过无线网络连接,当然也可以通过有线网络连接。如果是通过有线网络连接,一般的连接形式为光纤网络。
本申请实施例中,当用户设备需要与服务器共同开展某项业务时,用户设备将会通过接入网设备向服务器发送连接请求。服务器中与该业务对应的端口可以接收到该连接请求,根据该连接请求与用户设备建立通信连接。一个服务器具有多个网卡,一个网卡具有有多个网际互连协议(internet protocol,IP)地址,一个IP地址对应65535个端口,一个端口号与一个IP地址组合便形成一个用于与外界通信的套接字(socket)本端地址,端口(port)在计算机编程上也就是socket本端地址。
基于图1所描述的端口的管理系统,对本申请实施例提供的端口的管理方法进行描述。
请参阅图2,本申请实施例中端口的管理方法的一个实施例包括步骤201至步骤204。
201、服务器获取第一端口的信息,第一端口的信息包括第一端口用于侦听连接请求的最大时长。
本申请实施例中,服务器中具有多个端口。服务器可以与不同的用户设备开展不同的业务,业务与端口之间具有对应关系,第一端口为服务器上多个端口中的一个端口。一个 端口号与一个IP地址组合便形成一个用于与外界通信的套接字(socket)本端地址,端口在计算机编程上也就是socket本端地址。
本申请实施例中,服务器获取第一端口的信息之前,服务器可以根据端口号以及IP地址创建socket本端地址。该socket本端地址便是第一端口。
图3是本申请实施例提供的端口的管理方法的一实施例示意图。
请参阅图3,本申请实施例中所提及的端口可以处于侦听状态、使用状态以及关闭状态。端口处于侦听状态指示服务器通过该端口侦听用户设备发送的连接请求。端口处于使用状态指示服务器通过该端口与用户设备通信,端口处于关闭状态指示服务器无法通过该端口接收用户设备发送的连接请求以及用户设备无法通过该端口与用户设备通信。
可选的,第一端口的信息可以包括第一端口用于侦听连接请求的最大时长,第一端口的信息还可以包括第一端口的端口号以及IP地址,第一端口的信息还可以包括其他与第一端口相关的参数,具体此处不做限定。
202、服务器将第一端口设置为侦听状态。
本申请实施例中,侦听状态用于指示第一端口侦听用户设备发送的连接请求,该连接请求用于请求服务器与用户设备建立通信。
服务器通过调用与第一端口相关的应用程序接口(application programming interface,API)函数中的侦听(listen)函数的方式将第一端口设置为侦听状态,进而,服务器可以通过处于侦听状态的第一端口侦听用户设备发送的连接请求。
203、服务器获取第一端口的侦听时长。
本申请实施例中,当服务器将第一端口设置为侦听状态之后,服务器将会启动定时器模块,该定时器模块可以记录第一端口的侦听时长,该第一端口的侦听时长为第一端口设置为侦听状态之后的时长。
204、当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。
本申请实施例中,首先,服务器会获取第一端口的信息,服务器将第一端口设置为侦听状态。然后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。这样的端口管理方式出错率低,准确性高,且节约了人力资源,服务器的管理能力强。
本申请实施例中步骤203所提及的服务器获取第一端口的侦听时长有具体的实现方式,该具体的实现方式将在下面的实施例中进行说明。
可选的,服务器周期性地获取第一端口的侦听时长。
图4是本申请实施例提供的端口的管理方法的一实施例示意图。
请参阅图4,服务器内部包括端口管理软件,该端口管理软件中包括端口管理模块、端口模块以及定时器模块。
服务器预先设置定时发送时长,端口管理系统中包括的定时器模块会根据该定时发送时长周期性地向端口管理模块发送定时检查消息,端口管理模块接收到该定时检查消息之后,将会获取第一端口的侦听时长。
可选的,此处以第一定时器根据定时发送时长周期性地向端口管理模块发送定时检查 消息为例进行说明,还可以有其他的实现方式,具体此处不做限定。
本申请实施例中步骤203所提及的服务器获取第一端口的侦听时长,是当用户设备未通过第一端口接入服务器时执行的操作,当用户设备通过第一端口接入服务器时服务器所执行的操作将在下面的实施例中进行详细说明。
请参阅图5,本申请实施例中端口的管理方法的一个实施例包括步骤301至步骤305。
301、服务器通过第一端口接收用户设备发送的连接请求。
本申请实施例中,服务器会调用与第一端口相关的l isten函数,从而将第一端口设置为侦听状态。当用户设备需要与服务器共同开展某项业务时,服务器可以通过该处于侦听状态的第一端口接收用户设备发送的连接请求。
302、服务器根据连接请求对用户设备鉴权。
本申请实施例中,用户设备通过第一端口向服务器发送连接请求之后,服务器将会调用与第一端口对应的API函数中的连接(accept)函数接受用户设备发送的连接请求,服务器可以根据该连接请求对用户设备鉴权。
可选的,服务器接收到用户设备发送的连接请求之后,服务器可以判断该连接请求中是否包括鉴权证书。该鉴权证书用于指示该用户设备具备与服务器建立通信连接的资格。若连接请求中包括鉴权证书,则该用户设备可以通过服务器的鉴权。若该连接请求中不包括鉴权证书,则该用户设备不能通过服务器的鉴权。
可选的,服务器接收到用户设备发送的连接请求之后,服务器可以获取该连接请求中包含的用户设备的IP地址以及用户设备的端口号,服务器根据用户设备的IP地址以及用户设备的端口号向用户设备发送登录请求。当用户设备接收到该登录请求之后,用户设备登录成功,则该用户设备可以通过服务器的鉴权。若用户设备登录失败,则该用户设备不能通过服务器的鉴权。
可选的,上述实施例中以服务器可以判断该连接请求中是否包括鉴权证书的方式,以及服务器根据用户设备的IP地址以及用户设备的端口号向用户设备发送登录请求的方式为例进行说明,服务器还可以通过其他的鉴权方式对用户设备鉴权,具体此处不做限定。
303、若服务器确认用户设备通过鉴权,则服务器将第一端口由侦听状态切换为使用状态。
本申请实施例中,服务器确认用户设备通过鉴权之后,根据该连接请求创建已连接socket,进而,服务器可以通过该已连接socket与用户设备进行通信。第一端口便由侦听状态切换为使用状态。
304、服务器接收连接结束指令。
本申请实施例中,当服务器与用户设备之间开展的业务结束之后,服务器与用户设备之间则不再相互发送报文。服务器将会接接收到连接结束指令。
305、服务器根据连接结束指令设置第一端口的状态。
本申请实施例中步骤305中所提及的第一端口具有不同的类别。可选的,第一端口可以是长连接端口,第一端口还可以是短连接端口,下面将分别进行描述。
服务器与用户设备之间采用长连接的方式进行通信的端口,为长连接端口。
长连接是指在一个连接上可以连续发送多个数据包,在连接保持期间,如果没有数据 包发送,需要双方发链路检测包。
当服务器与用户设备共同开展某项业务时,服务器通过第一端口与用户设备建立通信连接。根据业务的需求,服务器通过第一端口频繁的向用户设备发送报文,或,服务器通过第一端口频繁的接收用户设备发送的报文,则服务器可以将第一端口设置为长连接端口。
服务器与用户设备之间采用短连接的方式进行通信的端口,为短连接端口。
短连接是指通讯双方有数据交互时,就建立一个连接,数据发送完成后,则断开此连接,即每次连接只完成一项业务的发送。
服务器出厂前,设备提供商会根据业务的连接需要来设定端口的类型。用户设备与服务器共同开展A业务。若A业务需要用户设备与服务器之间频繁建立通信连接,设备提供商可以将与A业务对应的端口配置为长连接端口。根据A业务的需求,用户设备与服务器之间建立通信连接的频率较低时,设备提供商可以将与A业务对应的端口配置为短连接端口。
示例性的,像全球广域网(world wide web,WEB)网站的http服务一般都用短链接的方式进行通信。因为长连接对于服务端来说会耗费一定的资源,而像WEB网站这么频繁的成千上万甚至上亿客户端的连接,采用短连接的方式进行通信会节省WEB服务器的资源。如果成千上万的用户端采用长连接的方式与WEB服务器建立通信,每个用户占用一个连接通道,将会极大地占用服务器的资源,降低服务器的运行效率。
可选的,当第一端口为长连接端口时,上述步骤305所提及的服务器根据连接结束指令设置第一端口的状态具有具体的实现方式,该具体的实现方式将在下面进行详细说明。
本申请实施例中,当第一端口为长连接端口时,服务器与用户设备之间通信较为频繁。当服务器与用户设备暂停通信之后,服务器将会接收到连接结束指令,服务器可以根据连接结束指令设置第一端口保持为使用状态。当服务器与用户设备恢复通信之后,用户设备可以直接通过处于使用状态的第一端口与服务器建立通信。
可选的,当第一端口为短连接端口时,上述步骤305所提及的服务器根据连接结束指令设置第一端口的状态具有具体的实现方式,该具体的实现方式将在下面进行详细说明。
本申请实施例中,当第一端口为短连接端口时,服务器与用户设备之间通信频率较低。当服务器与用户设备暂停通信之后,服务器将会接收到连接结束指令,服务器中包括的端口管理模块可以根据连接结束指令将第一端口设置为侦听状态。处于侦听状态的第一端口将会继续侦听用户设备发送的连接请求。服务器中包括的端口管理模块将会继续获取第一端口的侦听时长,当侦听时长超过第一端口用于侦听连接请求的最大时长之后,还没有用户设备通过第一端口向服务器发送连接请求,则端口管理模块将第一端口由侦听状态切换为关闭状态。
本申请实施例中步骤201至步骤204中所提及的第一端口具有不同的类别。可选的,第一端口可以是长连接端口,第一端口还可以是短连接端口,下面将分别进行描述。
第一端口为长连接端口。
本申请实施例中,当第一端口为长连接端口时,本申请实施例中提及的服务器具有两种不同的状态。可选的服务器可以处于调测态,服务器也可以处于正常态,下面将进行详细描述。
当服务器处于调测态时,上述步骤201所提及的服务器获取第一端口的信息以及步骤202所提及的服务器将第一端口设置为侦听状态具有具体的实现方式,该具体的实现方式将在下面进行详细说明。
当服务器处于正常态时,上述步骤203所提及的服务器获取第一端口的侦听时长以及步骤204所提及的当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态具有具体的实现方式,该具体的实现方式将在下面进行详细说明。
请参阅图6,本申请实施例中端口的管理方法的一个实施例包括步骤401至步骤406。
401、服务器获取第一端口的信息,第一端口的信息包括第一端口用于侦听连接请求的最大时长。
图7是本申请实施例提供的端口的管理方法的一实施例示意图。
请参阅图7,本申请实施例中,服务器刚出厂时,服务器的系统被默认为调测态。运营商将会根据服务器与用户设备之间的业务需求来配置服务器。此时,服务器处于被配置的状态则被称为调测态。处于调测态的服务器中包括的端口管理模块会获取服务器所有的长连接端口的信息,第一端口是服务器中所有的长连接端口中的一个端口。
402、服务器将第一端口设置为侦听状态。
本申请实施例中,当服务器处于调测态时,第一端口是长连接端口中的一个端口。服务器中端口管理模块会向端口模块发送侦听指令,端口模块根据侦听指令将所有的长连接端口均设置为侦听状态。当用户设备根据业务需求需要与服务器建立通信连接时,用户设备可以向处于侦听状态的长连接端口发送连接请求。
403、服务器接收第一切换指令。
请参阅图7,本申请实施例中,当运营商完成服务器的调测之后,运营商可以将服务器由调测态切换为正常态。
第一切换指令可以指示服务器由调测态切换为正常态。
可选的,服务器可以接收运营商在操作面板上所发出的第一切换指令,服务器中包括的端口管理模块接收到第一切换指令之后,会根据该第一切换指令将服务器由调测态切换为正常态。
可选的,服务器可以预先设置调测最大时长,该调测最大时长为服务器处于调测态的最大时长。服务器中包括的定时器模块将会记录服务器处于调测态的时长,当定时器模块确认服务器处于调测态的时间超过调测最大时长时,服务器中的定时器模块将会向端口管理模块发送超时信息,该超时信息便是第一切换指令,端口管理模块可以根据该第一切换指令将服务器由调测态切换为正常态。
可选的,服务器可以预先设置调测最大时长,该调测最大时长为服务器处于调测态的最大时长。服务器中包括的定时器模块将会记录服务器处于调测态的时长,当定时器模块确认服务器处于调测态的时间超过调测最大时长时,服务器中的定时器模块将会向端口管理模块发送超时信息。该超时信息用于提醒运营商服该务器处于调测态的时间超过调测最大时长,运营商根据可以该超时提醒信息在操作面板上执行第一切换指令。端口管理模块根据该第一切换指令将将服务器由调测态切换为正常态。若运营商认为服务器仍需要继续 配置,运营商则可以忽略该超时信息,不执行第一切换指令。
本申请实施例中,以运营商在操作面板上执行第一切换指令,服务器中包括的端口管理模块根据该第一切换指令将服务器由调测态切换为正常态,以及,服务器中的定时器模块向端口管理模块发送第一切换指令,服务器中包括的端口管理模块根据该第一切换指令将服务器由调测态切换为正常态为例进行说明。可以理解的是,还可以有其他的切换方式,具体此处不做限定。
404、服务器根据第一切换指令启动计时。
请参阅图7,本申请实施例中,服务器接中包括的端口管理模块收到第一切换指令之后,若用户设备未通过第一端口接入服务器,则服务器中的端口管理模块将向定时器模块发送启动计时指令。第一端口是服务器中所有的处于侦听状态的长连接端口中的一个端口。定时器模块接收到启动计时指令之后,将会对服务器中所有的处于侦听状态的长连接端口启动计时。
405、服务器获取第一端口的侦听时长。
请参阅图7,本申请实施例中,服务器中的定时器模块将会周期性地向端口管理模块发送定时检查消息。端口管理模块接收到定时检查消息之后,会从定时器模块处获取第一端口的侦听时长。
406、当侦听时长超过第一端口侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。
请参阅图7,本申请实施例中,服务器接中包括的端口管理模块将会判断侦听时长是否超过第一端口用于侦听连接请求的最大时长。当端口管理模块确认侦听时长超过第一端口用于侦听连接请求的最大时长时,端口管理模块会向端口模块发送关闭指令,端口模块根据关闭指令将第一端口由侦听状态切换为关闭状态。
第一端口为短连接端口。
请参阅图8,本申请实施例中端口的管理方法的一个实施例包括步骤501至步骤506。
501、服务器接收第二切换指令。
图8a是本申请实施例提供的端口的管理方法的另一实施例示意图。
请参阅图8a,本申请实施例中,第二切换指令用于指示服务器将第一端口设置为侦听状态。
502、服务器根据第二切换指令获取第一端口的信息。
本申请实施例中,第一端口为短连接端口。服务器中包括的端口管理模块将接收第二切换指令。第二切换指令中包括与第一端口相对应的端口号以及与第一端口相对应的IP地址。端口管理模块在接收到第二切换指令之后,才会根据第二切换指令中包括的与第一端口相对应的端口号以及与第一端口相对应的IP地址获取第一端口的信息。
可选的,运营商在服务器的操作面板上执行第二切换指令。服务器中包括的端口管理模块接收到第二切换指令之后,会根据第二切换指令获取第一端口的信息。
可选的,当用户设备通过第二端口与服务器建立通信连接时,第二端口处于使用状态。用户设备可以通过第二端口向服务器发送第二切换指令,服务器中包括的端口管理模块接收到第二切换指令之后,会根据第二切换指令获取第一端口的信息。
可选的,本申请实施例中以运营商在服务器的操作面板上执行第二切换指令以及用户设备通过第二端口向服务器发送第二切换指令为例进行说明,服务器还可以通过其他的方式接收第二切换指令,具体此处不做限定。
503、服务器将第一端口设置为侦听状态。
本申请实施例中,首先,服务器中的端口管理模块判断第一端口是否处于侦听状态,若端口管理模块确认第一端口已经处于侦听状态,则服务器中端口管理模块则不向端口模块发送侦听指令。若端口管理模块确认第一端口处于关闭状态,则端口管理模块向端口模块发送侦听指令,端口模块将第一端口设置为侦听状态。端口模块将第一端口设置为侦听状态之后,端口管理模块会向定时器模块发送启动计时指令,定时器模块会根据启动计时指令启动计时。
504、服务器获取第一端口的侦听时长。
本申请实施例中,步骤504与上述实施例中步骤405相类似,具体此处不做赘述。
505、当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。
本申请实施例中,步骤505与上述实施例中步骤406相类似,具体此处不做赘述。
本申请实施例中,首先,服务器会获取第一端口的信息,服务器将第一端口设置为侦听状态。然后,服务器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,服务器将第一端口由侦听状态切换为关闭状态。这样的端口管理方式提升了服务器的管理能力。
上述实施例提供了一种端口的管理方法的不同的实施方式,下面提供了一种服务器60,如图9所示,该服务器60用于执行上述实施例中服务器执行的步骤,该执行步骤以及相应的有益效果具体请参照上述相应的实施例进行理解,此处不再赘述,该服务器60包括:
处理单元601用于:
获取第一端口的信息,所述第一端口为所述服务器上用于通信的端口,所述第一端口的信息包括所述第一端口用于侦听连接请求的最大时长;
将所述第一端口设置为侦听状态,所述侦听状态用于指示所述第一端口侦听用户设备发送的连接请求,所述连接请求用于请求所述服务器与所述用户设备建立通信;
获取所述第一端口的侦听时长;
当所述侦听时长超过所述第一端口用于侦听连接请求的最大时长时,所述处理单元601将所述第一端口由所述侦听状态切换为关闭状态。
一种具体的实现方式中,所述处理单元601,
用于周期性地获取所述第一端口的侦听时长。
一种具体的实现方式中,
接收单元,用于通过所述第一端口接收所述用户设备发送的所述连接请求;
所述处理单元601,还用于根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态;
所述接收单元,还用于接收连接结束指令;
所述处理单元601,还用于根据所述连接结束指令设置所述第一端口的状态。
一种具体的实现方式中,
所述处理单元601,用于根据所述连接请求对所述用户设备鉴权;
若所述处理单元601确认所述用户设备通过鉴权,则所述处理单元601将所述第一端口由所述侦听状态切换为所述使用状态。
一种具体的实现方式中,所述第一端口为长连接端口,
所述处理单元601,用于根据所述连接结束指令设置所述第一端口保持所述使用状态。
一种具体的实现方式中,所述第一端口为短连接端口,
所述处理单元601,用于根据所述连接结束指令将所述第一端口由所述使用状态切换为所述侦听状态。
一种具体的实现方式中,所述第一端口为长连接端口,
所述接收单元,用于接收第一切换指令,所述第一切换指令用于指示所述服务器由调测态切换为正常态;
所述处理单元601,用于根据所述第一切换指令启动计时,所述计时用于指示所述处理单元601记录所述第一端口的侦听时长。
一种具体的实现方式中,
所述接收单元,还用于接收第二切换指令;
所述处理单元601,还用于根据所述第二切换指令获取所述第一端口的信息。
一种具体的实现方式中,
所述接收单元,用于通过第二端口接收所述第二切换指令,所述第二端口处于所述使用状态。
需要说明的是,上述服务器60的各模块之间的信息交互、执行过程等内容,由于与本申请方法实施例基于同一构思,其带来的技术效果与本发明方法实施例相同,具体内容可参见本申请前述所示的方法实施例中的叙述,此处不再赘述。
参阅图10所示,为本申请实施例提供一种服务器的结构示意图,该服务器700包括:处理器702、通信接口703、存储器701以及总线704。其中,通信接口703、处理器702以及存储器701通过总线704相互连接;总线704可以是外围部件互连标准(Peripheral Component Interconnect,PCI)总线或扩充工业标准体系结构(extended industry standard architecture,EISA)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图10中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。该服务器700可以实现图9所示的实施例中的服务器的功能。处理器702和通信接口703可以执行上述方法示例中服务器的相应功能。
下面结合图10对服务器的各个构成部件进行具体的介绍:
其中,存储器701可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);或者非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD);或者上述种类的存储器的组合,用于存储可实现本申请方法的程序代码、配置文件或其他内容。
处理器702是控制器的控制中心,可以是一个中央处理器(central processing unit, CPU),也可以是特定集成电路(application specific integrated circuit,ASIC),或者是被配置成实施本申请实施例的一个或多个集成电路,例如:一个或多个数字信号处理器(digital signal processor,DSP),或,一个或者多个现场可编程门阵列(field programmable gate array,FPGA)。
通信接口703用于与其他用户设备进行通信。
在一个示例中,通信接口703用于通过第一端口接收用户设备发送的连接请求。
在一个示例中,通信接口703用于接收连接结束指令。
在一个示例中,通信接口703用于接收第二切换指令。
在一个示例中,通信接口703用于通过第二端口接收第二切换指令,第二端口处于使用状态。
该处理器702可以执行前述图9所示实施例中服务器所执行的操作,具体此处不再赘述。
在一种可能的实现方式中,处理器702通过运行或执行存储在存储器701内的软件程序和/或模块,以及调用存储在存储器701内的数据,执行如下功能:
处理器将第一端口设置为侦听状态之后,处理器可以获取第一端口的侦听时长。当侦听时长超过第一端口用于侦听连接请求的最大时长时,处理器将第一端口由侦听状态切换为关闭状态。服务器的管理能力得到了提升。
本申请还提供了一种芯片系统,该芯片系统包括处理器,用于支持上述转发设备或控制设备实现其所涉及的功能,例如,例如接收或处理上述方法实施例中所涉及的报文和/或信息。在一种可能的设计中,所述芯片系统还包括存储器,所述存储器,用于保存计算机设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(Digital Subscriber Line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通 过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (20)

  1. 一种端口的管理方法,其特征在于,包括:
    服务器获取第一端口的信息,所述第一端口为所述服务器上用于通信的端口,所述第一端口的信息包括所述第一端口用于侦听连接请求的最大时长;
    所述服务器将所述第一端口设置为侦听状态,所述侦听状态用于指示所述第一端口侦听用户设备发送的连接请求,所述连接请求用于请求所述服务器与所述用户设备建立通信;
    所述服务器获取所述第一端口的侦听时长;
    当所述侦听时长超过所述第一端口用于侦听连接请求的最大时长时,所述服务器将所述第一端口由所述侦听状态切换为关闭状态。
  2. 根据权利要求1所述的端口的管理方法,其特征在于,所述服务器获取所述第一端口的侦听时长,包括:
    所述服务器周期性地获取所述第一端口的侦听时长。
  3. 根据权利要求1或2所述的端口的管理方法,其特征在于,所述方法还包括:
    所述服务器通过所述第一端口接收所述用户设备发送的所述连接请求;
    所述服务器根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态;
    所述服务器接收连接结束指令;
    所述服务器根据所述连接结束指令设置所述第一端口的状态。
  4. 根据权利要求3所述的端口的管理方法,其特征在于,所述服务器根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态,包括:
    所述服务器根据所述连接请求对所述用户设备鉴权;
    若所述服务器确认所述用户设备通过鉴权,则所述服务器将所述第一端口由所述侦听状态切换为所述使用状态。
  5. 根据权利要求3或4所述的端口的管理方法,其特征在于,所述第一端口为长连接端口,所述服务器根据所述连接结束指令设置所述第一端口的状态,包括:
    所述服务器根据所述连接结束指令设置所述第一端口保持所述使用状态。
  6. 根据权利要求3或4所述的端口的管理方法,其特征在于,所述第一端口为短连接端口,所述服务器根据所述连接结束指令设置所述第一端口的状态,包括:
    所述服务器根据所述连接结束指令将所述第一端口由所述使用状态切换为所述侦听状态。
  7. 根据权利要求1至5所述的端口的管理方法,其特征在于,所述第一端口为长连接端口,所述方法还包括:
    所述服务器接收第一切换指令,所述第一切换指令用于指示所述服务器由调测态切换为正常态;
    所述服务器根据所述第一切换指令启动计时,所述计时用于指示所述服务器记录所述第一端口的侦听时长。
  8. 根据权利要求6所述的端口的管理方法,其特征在于,所述方法还包括:
    所述服务器接收第二切换指令;
    服务器获取第一端口的信息,包括:
    所述服务器根据所述第二切换指令获取所述第一端口的信息。
  9. 根据权利要求8所述的端口的管理方法,其特征在于,所述服务器接收第二切换指令,包括:
    所述服务器通过第二端口接收所述第二切换指令,所述第二端口处于所述使用状态。
  10. 一种服务器,其特征在于,包括:
    处理单元用于:
    获取第一端口的信息,所述第一端口为所述服务器上用于通信的端口,所述第一端口的信息包括所述第一端口用于侦听连接请求的最大时长;
    将所述第一端口设置为侦听状态,所述侦听状态用于指示所述第一端口侦听用户设备发送的连接请求,所述连接请求用于请求所述服务器与所述用户设备建立通信;
    获取所述第一端口的侦听时长;
    当所述侦听时长超过所述第一端口用于侦听连接请求的最大时长时,所述处理单元将所述第一端口由所述侦听状态切换为关闭状态。
  11. 根据权利要求10所述的服务器,其特征在于,所述处理单元,
    用于周期性地获取所述第一端口的侦听时长。
  12. 根据权利要求10或11所述的服务器,其特征在于,
    接收单元,用于通过所述第一端口接收所述用户设备发送的所述连接请求;
    所述处理单元,还用于根据所述连接请求将所述第一端口由所述侦听状态切换为使用状态;
    所述接收单元,还用于接收连接结束指令;
    所述处理单元,还用于根据所述连接结束指令设置所述第一端口的状态。
  13. 根据权利要求12所述的服务器,其特征在于,
    所述处理单元,用于根据所述连接请求对所述用户设备鉴权;
    若所述处理单元确认所述用户设备通过鉴权,则所述处理单元将所述第一端口由所述侦听状态切换为所述使用状态。
  14. 根据权利要求12或13所述的服务器,其特征在于,所述第一端口为长连接端口,
    所述处理单元,用于根据所述连接结束指令设置所述第一端口保持所述使用状态。
  15. 根据权利要求12或13所述的服务器,其特征在于,所述第一端口为短连接端口,
    所述处理单元,用于根据所述连接结束指令将所述第一端口由所述使用状态切换为所述侦听状态。
  16. 根据权利要求10至14中任意一项所述的服务器,其特征在于,所述第一端口为长连接端口,
    所述接收单元,用于接收第一切换指令,所述第一切换指令用于指示所述服务器由调测态切换为正常态;
    所述处理单元,用于根据所述第一切换指令启动计时,所述计时用于指示所述处理单元记录所述第一端口的侦听时长。
  17. 根据权利要求15所述的服务器,其特征在于,
    所述接收单元,还用于接收第二切换指令;
    所述处理单元,还用于根据所述第二切换指令获取所述第一端口的信息。
  18. 根据权利要求17所述的服务器,其特征在于,
    所述接收单元,用于通过第二端口接收所述第二切换指令,所述第二端口处于所述使用状态。
  19. 一种服务器,其特征在于,包括:
    处理器、存储器和通信接口;
    所述处理器与所述存储器、所述通信接口相连;
    所述通信接口用于:
    通过所述第一端口接收所述用户设备发送的所述连接请求;
    接收连接结束指令;
    接收第二切换指令;
    通过第二端口接收所述第二切换指令,所述第二端口处于所述使用状态;
    所述处理器用于读取所述存储器中存储的指令后,使得所述服务器执行如权利要求1至9中任一项所述的方法。
  20. 一种计算机存储介质,其特征在于,所述计算机存储介质中存储有指令,所述指令在计算机上执行时,使得所述计算机执行如权利要求1至9中任一项所述的方法。
PCT/CN2020/115486 2020-01-17 2020-09-16 一种端口的管理方法及服务器 WO2021143172A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010054472.0A CN113139178A (zh) 2020-01-17 2020-01-17 一种端口的管理方法及服务器
CN202010054472.0 2020-01-17

Publications (1)

Publication Number Publication Date
WO2021143172A1 true WO2021143172A1 (zh) 2021-07-22

Family

ID=76808586

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/115486 WO2021143172A1 (zh) 2020-01-17 2020-09-16 一种端口的管理方法及服务器

Country Status (2)

Country Link
CN (1) CN113139178A (zh)
WO (1) WO2021143172A1 (zh)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100113079A1 (en) * 2008-10-31 2010-05-06 Motorola, Inc. System and method for managing affiliation requests in a communication system
CN102790685A (zh) * 2011-05-16 2012-11-21 国基电子(上海)有限公司 具有省电功能的网络设备及其省电方法
CN103297245A (zh) * 2013-06-21 2013-09-11 苏州鼎富软件科技有限公司 网络服务器
CN105072055A (zh) * 2015-09-17 2015-11-18 北京博维亚讯技术有限公司 一种以太网交换机及其端口轮询系统、轮询方法
CN106304407A (zh) * 2016-07-28 2017-01-04 杭州华三通信技术有限公司 一种通信方法及装置
CN108429730A (zh) * 2018-01-22 2018-08-21 北京智涵芯宇科技有限公司 无反馈安全认证与访问控制方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100113079A1 (en) * 2008-10-31 2010-05-06 Motorola, Inc. System and method for managing affiliation requests in a communication system
CN102790685A (zh) * 2011-05-16 2012-11-21 国基电子(上海)有限公司 具有省电功能的网络设备及其省电方法
CN103297245A (zh) * 2013-06-21 2013-09-11 苏州鼎富软件科技有限公司 网络服务器
CN105072055A (zh) * 2015-09-17 2015-11-18 北京博维亚讯技术有限公司 一种以太网交换机及其端口轮询系统、轮询方法
CN106304407A (zh) * 2016-07-28 2017-01-04 杭州华三通信技术有限公司 一种通信方法及装置
CN108429730A (zh) * 2018-01-22 2018-08-21 北京智涵芯宇科技有限公司 无反馈安全认证与访问控制方法

Also Published As

Publication number Publication date
CN113139178A (zh) 2021-07-20

Similar Documents

Publication Publication Date Title
US20140115142A1 (en) Port Setting Method, Routing Device, and Computer Program Product
WO2020207043A1 (zh) 基站开站方法、装置、计算机存储介质及设备
US20180091581A1 (en) Method of switching download mode, control method thereof and control system thereof
US20220060881A1 (en) Group management method, apparatus, and system
TWM355517U (en) Integration of 802.21 media independent handover functionality to radio interface layer and telephony server
US11863529B2 (en) Private cloud routing server connection mechanism for use in a private communication architecture
CN111030892B (zh) 一种测试bmc ncsi自适应模式下网络功能的方法、设备及介质
WO2018129876A1 (zh) 多媒体数据传输的方法、服务器和终端
CN106603352B (zh) 一种智能家居用户、应用服务器管理负载均衡的系统及方法
WO2014116210A1 (en) Balancing access point workloads
WO2021190488A1 (zh) 一种建立连接的方法和通信装置以及系统
WO2023050667A1 (zh) 一种实现裸金属检查流程的方法、系统、设备和存储介质
US20160366571A1 (en) Connection-Oriented Messaging and Signaling in Mobile Heath Networks
WO2022121660A1 (zh) 远程自动化抓包的实现方法、装置及系统
WO2021143172A1 (zh) 一种端口的管理方法及服务器
US20200389359A1 (en) Unidirectional link detection mode auto-detection
US9256416B1 (en) Methods and apparatus for automatic session validation for distributed access points
WO2021134562A1 (zh) 配置设备更换方法、装置、设备及存储介质
US20200267116A1 (en) Internet protocol version six address management
US9167543B2 (en) Synchronization of mobile client multicast
US11683292B2 (en) Private cloud routing server connection mechanism for use in a private communication architecture
TW202233007A (zh) 用於私有通訊架構的連接方法與電腦可讀取媒體
US8285853B2 (en) Message and system for implementing the inter-access of stack members
CN113709163A (zh) 一种基于无线终端实现远程操作电脑的方法及系统
WO2011147321A1 (zh) 在家庭网关中统一号码通信的方法、装置和系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20914444

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20914444

Country of ref document: EP

Kind code of ref document: A1