CN104202334B - A kind of method and device for establishing network connection - Google Patents

A kind of method and device for establishing network connection Download PDF

Info

Publication number
CN104202334B
CN104202334B CN201410472857.3A CN201410472857A CN104202334B CN 104202334 B CN104202334 B CN 104202334B CN 201410472857 A CN201410472857 A CN 201410472857A CN 104202334 B CN104202334 B CN 104202334B
Authority
CN
China
Prior art keywords
port
network
information
server
network port
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201410472857.3A
Other languages
Chinese (zh)
Other versions
CN104202334A (en
Inventor
吴凡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Cheetah Network Technology Co Ltd
Original Assignee
Guangzhou Cheetah Network Technology Co Ltd
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 Guangzhou Cheetah Network Technology Co Ltd filed Critical Guangzhou Cheetah Network Technology Co Ltd
Priority to CN201410472857.3A priority Critical patent/CN104202334B/en
Publication of CN104202334A publication Critical patent/CN104202334A/en
Application granted granted Critical
Publication of CN104202334B publication Critical patent/CN104202334B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses a kind of method and devices for establishing network connection.A method of network connection is established, server is applied to, this method includes:The request message that client is sent is obtained, the request message that client is sent carries the communication method information that the client is communicated with the server;According to the corresponding relationship of the network port in preset communication method information and the server, the port information of the network port of the communication method information corresponded in the request message is obtained;Port information obtained is sent to the client, is connected to the network so that the client is established with the network port for corresponding to the port information.Using above-mentioned technical proposal, the network port in server changes, and the embodiment of the present invention still is able to the request message sent according to the client, determines the port information for corresponding to the network port of the request message, then the port information is sent to client, so that the two establishes network connection.

Description

A kind of method and device for establishing network connection
Technical field
The present invention relates to Internet technical field, in particular to a kind of method and device for establishing network connection.
Background technique
Core equipment one of of the server as the network equipment, the forwarding of message, the storage of content and in terms of In occupation of leading position.Server generally includes the network port of multiple types, and the different types of network port provides different Function.The different function of client executing just requires connect on the different network ports of the server, such as payment software When executing its payment function, it is necessary to be connected on the payment network port of corresponding server.
In the prior art, when executing a certain function, client can have client function according to local pre-stored record The network port for corresponding to this function in the server can be found, is connected to the network with the document of network port corresponding relationship.
However, once the network port in server changes, the network port and client functionality in the server Corresponding relationship can also change, and client has the text of client functionality Yu network port corresponding relationship according to original record Shelves, can not find the network port corresponding with its function, lead to connection failure.
Summary of the invention
To solve the above-mentioned problems, the embodiment of the invention discloses a kind of method and devices for establishing network connection, specifically Technical solution is as follows:
A method of network connection is established, is applied to server, the server includes multiple network ports, the side Method includes:
Obtain the request message that client is sent, the request message that the client is sent carry the client with it is described The communication method information that server is communicated;
According to the corresponding relationship of the network port in preset communication method information and the server, obtains and correspond to institute State the port information of the network port of the communication method information in request message;
Port information obtained is sent to the client so that the client with correspond to the port information The network port establishes network connection.
Optionally, the corresponding relationship according to the network port in preset communication method information and the server, The port information of the network port of the communication method information corresponded in the request message is obtained, including:
According to the corresponding relationship of the network port in preset communication method information and the server, determines and correspond to institute State the network port of the communication method information in request message;
The port information for a network port being in idle condition in the network port determined by obtaining.
Optionally, multiple network ports that the server includes carry type identification;The method also includes:
Count the duration that all types of network ports are in running order in the first preset duration;
Increase the port number of the network port of target type, the target type is that operating time is more than the first default threshold Port type belonging to the network port of value.
Optionally, the method also includes:
Count the quantity of the in running order network port;
The obtained quantitative value of statistics is output to display equipment, so as to user can port service condition to server into Row monitoring.
Optionally, the method also includes:
Obtain the status information of the network port;
The status information for the network port that will acquire is output to display equipment, so that user can be to the port of server Working condition is monitored.
Optionally, the communication mode of the client and the server is long connection type or short connection type;Work as institute When the communication mode for stating client and the server is long connection type, the method also includes:
Monitor the network connection disconnection times in the second preset duration between the client and the network port;
It will be switched off number and reach the network port of the second preset threshold labeled as failure;
It determines in the server corresponding to the client present communications mode, the unmarked network-side for failure Mouthful, obtain the port information of a network port in the identified network port;
The port information is sent to the client, so that the client and the network-side for corresponding to the port information Mouth establishes network connection.
A method of network connection is established, client is applied to, the method includes:
Request message is sent to server, the request message carries what the client was communicated with the server Communication method information;
The server is received after obtaining the request message, the communication mode of transmission corresponded in the request message The port information of the network port of information;It is stored in the server in preset communication method information and the server The corresponding relationship of the network port;
Establish the network connection of the network port corresponding with received port information.
A kind of device for establishing network connection, is applied to server, the server includes multiple network ports, the dress Set including:
Message capturing module, for obtaining the request message of client transmission, the request message that the client is sent is taken The communication method information communicated with the client with the server;
The first information obtains module, for according to the network port in preset communication method information and the server Corresponding relationship obtains the network port of the communication method information corresponded in request message acquired in the message capturing module Port information;
First information sending module, it is described for first information acquisition module port information obtained to be sent to Client is connected to the network so that the client is established with the network port for corresponding to the port information.
Optionally, the first information obtains module, including:
Port determines submodule, for pair according to the network port in preset communication method information and the server It should be related to, determine the network port of the communication method information corresponded in request message acquired in the message capturing module;
Information acquisition submodule determines in the network port determined by submodule for obtaining the port in idle shape The port information of one network port of state.
Optionally, multiple network ports that the server includes carry type identification;Described device further includes:
Duration statistical module, for counting the duration that all types of network ports are in running order in the first preset duration;
Port number increases module, the port number of the network port for increasing target type, and the target type is Operating time is more than port type belonging to the network port of the first preset threshold.
Optionally, described device further includes:
Quantity statistics module, for counting the quantity of the in running order network port;
First output module, the quantitative value for counting the quantity statistics module are output to display equipment, with Just user can the port service condition to server be monitored.
Optionally, described device further includes:
State information acquisition module, for obtaining the status information of the network port;
Second output module, the status information output of the network port for getting the state information acquisition module To display equipment, so as to user can the port working state to server be monitored.
Optionally, the communication mode of the client and the server is long connection type or short connection type;Work as institute When the communication mode for stating client and the server is long connection type, described device further includes:
Monitoring modular is disconnected for monitoring the network connection in the second preset duration between the client and the network port Number;
Mark module, for by the monitoring module monitors to disconnection times reach the network port of the second preset threshold Labeled as failure;
Second information acquisition module, for determine in the server corresponding to the client present communications mode, The unmarked network port for failure obtains the port information of a network port in the identified network port;
Second information sending module, it is described for the second information acquisition module port information obtained to be sent to Client is connected to the network so that the client is established with the network port for corresponding to the port information.
A kind of device for establishing network connection, is applied to client, and described device includes:
Message transmission module, for server send request message, the request message carry the client with The communication method information that the server is communicated;
Information receiving module is obtaining request message transmitted by the message transmission module for receiving the server Afterwards, the port information of the network port for corresponding to the communication method information in the request message of transmission;It is deposited in the server Contain the corresponding relationship of the network port in preset communication method information and the server;
Module is established in network connection, for establishing net corresponding with port information received by the information receiving module The network connection of network port.
Method and device provided in an embodiment of the present invention can be according to pre- after obtaining the request message that client is sent If communication method information and server in the network port corresponding relationship, determine correspond to the request message in communication The port information of the network port of mode information, and identified port information is sent to the client, so that the visitor Family end is established with the network port for corresponding to the port information and is connected to the network.
Compared with prior art, the network port in server changes, and the embodiment of the present invention still is able to according to the visitor The request message that family end is sent determines the port information for corresponding to the network port of the request message, then by the port information It is sent to client, so that the two establishes network connection.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow chart of method for establishing network connection provided in an embodiment of the present invention;
Fig. 2 is a kind of flow chart of embodiment of S102 in Fig. 1 provided in an embodiment of the present invention;
Fig. 3 is the flow chart of another method for establishing network connection provided in an embodiment of the present invention;
Fig. 4 is the flow chart of another method for establishing network connection provided in an embodiment of the present invention;
Fig. 5 is the flow chart of another method for establishing network connection provided in an embodiment of the present invention;
Fig. 6 is the flow chart of another method for establishing network connection provided in an embodiment of the present invention;
Fig. 7 is the flow chart of another method for establishing network connection provided in an embodiment of the present invention;
Fig. 8 is a kind of structural schematic diagram of device for establishing network connection provided in an embodiment of the present invention;
Fig. 9 is a kind of structural schematic diagram that the first information obtains module 802 in Fig. 8 provided in an embodiment of the present invention;
Figure 10 is the structural schematic diagram of another device for establishing network connection provided in an embodiment of the present invention;
Figure 11 is the structural schematic diagram of another device for establishing network connection provided in an embodiment of the present invention;
Figure 12 is the structural schematic diagram of another device for establishing network connection provided in an embodiment of the present invention;
Figure 13 is the structural schematic diagram of another device for establishing network connection provided in an embodiment of the present invention;
Figure 14 is the structural schematic diagram of another device for establishing network connection provided in an embodiment of the present invention.
Specific embodiment
In order to make those skilled in the art more fully understand the technical solution in the present invention, implement below in conjunction with the present invention Attached drawing in example, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment Only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, the common skill in this field Art personnel every other embodiment obtained without making creative work belongs to the model that the present invention protects It encloses.
One of core equipment as the network equipment, server the forwarding of message, the storage of content and in terms of In occupation of leading position.Server generally includes the network port of multiple types, and the different types of network port provides different Function.The different function of client executing just requires connect on the different network ports of the server, such as downloading software When executing its download function, it is necessary to be connected on the downloading network port of corresponding server.
In the existing method for establishing network connection, client needs to have client function according to local pre-stored record The network port for corresponding to this function in the server can be found, is connected to the network with the document of network port corresponding relationship. But when the network port upgrading or port number variation in server, client cannot have according to original record The document of client functionality and network port corresponding relationship can not find corresponding port.To solve the above-mentioned problems, of the invention A kind of method and device for foundation network connection that embodiment provides.
First below to it is provided in an embodiment of the present invention it is a kind of establish network connection method be introduced.
It should be noted that present invention method, suitable for server, the server includes multiple network-sides Mouthful;In practical applications, which can be the IM chat server developed based on netty.
As shown in Figure 1, a kind of method for establishing network connection provided in an embodiment of the present invention, is applied to server, it is described Server includes multiple network ports, and this method may include:
S101, obtains the request message that client is sent, and the request message that the client is sent carries the client The communication method information communicated with the server.
It should be noted that in a larger sense, communication mode can be divided into:Long connection type and short connection type, Wherein, long connection type, which refers to, can continuously transmit multiple data packets in a connection, during connecting holding, if do not counted It is sent according to packet, both sides is needed to send out link detecting packet;When short connection type refers to that communication two party has data interaction, a company is just established It connects, after data are sent completely, then disconnect this connection, i.e., connect the transmission for only completing a business every time.For example, client carries out When website and webpage access, the communication mode used is short connection type;When chat tool carries out Internet chat, the communication party of use Formula is long connection type.
Specifically, in practical applications, long connection type may include the communication mode of chat-type;Short connection type can To include:The communication mode of the communication mode of type of payment, the communication mode of type of download or website visiting type.For example it props up When the tool of paying carries out network payment, the communication mode of use is exactly the communication mode of type of payment;Download tool is downloaded from network When content, the communication mode of use is exactly the communication mode of type of download.
In addition, client functionality is in diversified development, the division of labor of the network port is more and more clear in server, a seed type The network port usually only provide a kind of function for client, for example, the payment network port in server is only payment work Tool provides network on-line payment function, and the downloading network port is only download tool and provides network download online function, website net Network port is only website visiting tool and provides online access web sites function.It should be noted that above-mentioned is only implementation of the present invention Example a specific example, the embodiment of the present invention includes but be not limited to above example.
It is understood that client must obtain the network-side that can be realized the function before realizing a certain function The port information of mouth, the network connection of the network port to be built on, to realize its function according to the port information got Energy.
In embodiments of the present invention, due to including numerous network ports, and the network port of each type in server The function of offer is different, and therefore, this request message for just needing server that can be sent according to client finds correspondence The network port of function is currently executed in client.
Further, it since type network a certain in server port usually only corresponds to a kind of communication mode, is only adopting In the case where the communication mode, client could be established with the network port and is connected to the network.Therefore, this just needs server energy It is enough to be found current corresponding to client from numerous network ports according to the request message for carrying communication method information Execute the network port of function.
S102, according to the corresponding relationship of the network port in preset communication method information and the server, acquisition pair The port information of the network port of communication method information in request message described in Ying Yu.
It should be noted that in practical applications, after the definition or update for completing local network port, server can be with It is locally generated the file that record has the network port Yu communication mode corresponding relationship, so that the server carries out looking into for the network port It is used when looking for.
It further, can be according in local after obtaining the communication method information in the request message that client is sent Record has the file of the corresponding relationship of the network port in communication method information and server, it is first determined and should in the server Which the corresponding network port of communication method information has;Later, it can select one from the identified network port and be used for The network port being connected to the network with the client, and obtain the port information of the network port.
Specifically, in an embodiment of the embodiment of the present invention, as shown in Fig. 2, above-mentioned S102, may include:
S102a, according to the corresponding relationship of the network port in preset communication method information and the server, determining pair The network port of communication method information in request message described in Ying Yu.
It is understood that a type of network port generally comprises multiple network ports in server, the server Multiple network ports corresponding to the communication mode can be found according to a kind of communication mode.
S102b obtains the port information for a network port being in idle condition in the identified network port.
Preferably, it is connected to the network to guarantee more quickly to establish with the server, identified network-side can be obtained The port information for a network port being in idle condition in mouthful.
Port information obtained is sent to the client by S103 so that the client with correspond to the port The network port of information establishes network connection.
In embodiments of the present invention, the port letter for corresponding to the network port of communication method information obtained is being obtained Breath, need port information obtained being sent to the client so that the client with correspond to transmitted port The network port of information establishes network connection.
It can be seen that the method provided in an embodiment of the present invention for establishing network connection, in the request for obtaining client transmission After message, it can determine according to the corresponding relationship of the network port in preset communication method information and server and correspond to institute It states the port information of the network port of the communication method information in request message, and identified port information is sent to described Client is connected to the network so that the client is established with the network port for corresponding to the port information.
Compared with prior art, the network port in server changes, and the embodiment of the present invention still is able to according to the visitor The request message that family end is sent determines the port information for corresponding to the network port of the request message, then by the port information It is sent to client, so that the two establishes network connection.
Optionally, in one embodiment of the invention, multiple network ports that the server includes carry class Type mark;The method provided in an embodiment of the present invention for establishing network connection can be to increase on the basis of method shown in Fig. 1 S104 and S105.
It, can also be with it should be noted that S104 and S105 can both be executed according to the execution of method shown in Fig. 3 sequence Each step in method shown in Fig. 1 executes parallel, and the embodiment of the present invention is not construed as limiting this.S104 and S105 is carried out below detailed Thin description.
S104 counts the duration that all types of network ports are in running order in the first preset duration.
Such as first preset duration be 1 hour, in server include 4 kinds of network ports, respectively the first kind network port, The second class network port, the third class network port, the 4th class network port, wherein have 3 network-sides in the first kind network port Mouthful, there are 3 network ports in the second class network port, there is 4 network ports, the 4th class network port in the third class network port In have 5 network ports, in 1 hour, the work total duration of 3 network ports is 20 minutes in the first kind network port, the The work total duration of 3 network ports is 30 minutes in the two class network ports, the work of 4 network ports in the third class network port Making total duration is 50 minutes, and the work total duration of 5 network ports is 30 minutes in the 4th class network port.
It should be noted that can according to the actual situation, to the value of the first preset duration in the embodiment of the present invention into Row adjustment, it is not limited in the embodiment of the present invention.
S105, increases the port number of the network port of target type, and the target type is that operating time is more than first Port type belonging to the network port of preset threshold.
Such as first preset threshold be 45 minutes, since the work of 4 network ports in the above-mentioned third class network port is total Shi Changwei 50 minutes, be more than 45 minutes, therefore can increase the port number of the network port in the third class network port.
It should be noted that can according to the actual situation, to the value of the first preset threshold in the embodiment of the present invention into Row adjustment, it is not limited in the embodiment of the present invention.
It can be seen that the method provided in an embodiment of the present invention for establishing network connection, it can be according to the reality of each network port The port number of all types of network ports in the server is adaptively adjusted in border service condition, improves the port benefit of server With rate.
Optionally, in one embodiment of the invention, provided in an embodiment of the present invention to establish the method being connected to the network also It can be to increase S106 and S107 on the basis of method shown in Fig. 1.
It, can also be with it should be noted that S106 and S107 can both be executed according to the execution of method shown in Fig. 4 sequence Each step in method shown in Fig. 1 executes parallel, and the embodiment of the present invention is not construed as limiting this.S106 and S107 is carried out below detailed Thin description.
S106 counts the quantity of the in running order network port.
Optionally, in one embodiment of the embodiment of the present invention, it can count in running order under current time The quantity of the network port.
It optionally, can be according to the preset time cycle, periodically in an embodiment of the embodiment of the present invention Count the quantity of the in running order network port.
Optionally, in an embodiment of the embodiment of the present invention, in running order net can be counted in real time The quantity of network port.
The quantitative value that statistics obtains is output to display equipment, so that user can use the port of server by S107 Situation is monitored.
Further, after the quantity for counting the in running order network port, obtained quantitative value will can be counted Output so that user is monitored, analyzes, and then improves the responding ability and working efficiency of user.
Optionally, in one embodiment of the invention, provided in an embodiment of the present invention to establish the method being connected to the network also It can be to increase S108 and S109 on the basis of method shown in Fig. 1.
It, can also be with it should be noted that S108 and S109 can both be executed according to the execution of method shown in Fig. 5 sequence Each step in method shown in Fig. 1 executes parallel, and the embodiment of the present invention is not construed as limiting this.S108 and S109 is carried out below detailed Thin description.
S108 obtains the status information of the network port.
Optionally, in one embodiment of the embodiment of the present invention, the state of available current time lower network port Information.
It optionally, can be according to the preset time cycle, periodically in an embodiment of the embodiment of the present invention Obtain the status information of the network port.
Optionally, in an embodiment of the embodiment of the present invention, the state letter of the network port can be obtained in real time Breath.
S109, the status information for the network port that will acquire are output to display equipment, so that user can be to server Port working state be monitored.
Further, after the status information for obtaining the network port, the status information for the network port that can be will acquire Output so that user is monitored, analyzes, and then improves the responding ability and working efficiency of user.
Optionally, in one embodiment of the invention, the communication mode of the client and the server is long connects Connect mode or short connection type;When the communication mode of the client and the server is long connection type, the present invention is real Apply example offer foundation network connection method can on the basis of method shown in Fig. 1 increase S110, S111, S112 and S113。
It should be noted that S110, S111, S112 and S113 can both be held according to the execution of method shown in Fig. 6 sequence Row, can also execute, the embodiment of the present invention is not construed as limiting this parallel with each step in method shown in Fig. 1.Below to S110, S111, S112 and S113 are described in detail.
S110 monitors the network connection disconnection times in the second preset duration between the client and the network port.
It is understood that when the communication mode of client and server is long connection type, the client and service Device needs to keep network connection state within a certain period of time, for example chat tool is when carrying out online chatting, it is necessary to protect always It holds and is in network connection state with server.If during this period, the network connection of client and server often disconnects, such as Chat tool often goes offline, and just will affect the usage experience of user.
Based on the above issues, the embodiment of the present invention can be to the network connection disconnection times between client and the network port It is monitored, further, the network connection that can be monitored in the second preset duration between the client and the network port is disconnected Open number.
It should be noted that can according to the actual situation, to the value of the second preset duration in the embodiment of the present invention into Row adjustment, it is not limited in the embodiment of the present invention.
S111 will be switched off number and reach the network port of the second preset threshold labeled as failure.
It should be noted that can according to the actual situation, to the value of the second preset threshold in the embodiment of the present invention into Row adjustment, it is not limited in the embodiment of the present invention.
It can be seen that the method provided in an embodiment of the present invention for establishing network connection, can automatically detect network connection It is failure in the presence of the abnormal network port, and by the port label, thus the quick positioning device failure of aspect operation maintenance personnel.
S112 is determined in the server corresponding to the client present communications mode, the unmarked net for failure Network port obtains the port information of a network port in the identified network port.
The port information is sent to the client by S113 so that the client with correspond to the port information The network port establishes network connection.
As shown in fig. 7, a kind of method for establishing network connection provided in an embodiment of the present invention, is applied to client, the party Method may include:
S701 sends request message to server, and the request message carries the client and the server carries out The communication method information of communication.
It should be noted that in a larger sense, communication mode can be divided into:Long connection type and short connection type, Wherein, long connection type, which refers to, can continuously transmit multiple data packets in a connection, during connecting holding, if do not counted It is sent according to packet, both sides is needed to send out link detecting packet;When short connection type refers to that communication two party has data interaction, a company is just established It connects, after data are sent completely, then disconnect this connection, i.e., connect the transmission for only completing a business every time.For example, client carries out When website and webpage access, the communication mode used is short connection type;When chat tool carries out Internet chat, the communication party of use Formula is long connection type.
Specifically, in practical applications, long connection type may include the communication mode of chat-type;Short connection type can To include:The communication mode of the communication mode of type of payment, the communication mode of type of download or website visiting type.For example it props up When the tool of paying carries out network payment, the communication mode of use is exactly the communication mode of type of payment;Download tool is downloaded from network When content, the communication mode of use is exactly the communication mode of type of download.
S702 receives the server after obtaining the request message, and corresponding to for transmission is logical in the request message The port information of the network port of letter mode information;Preset communication method information and the service are stored in the server The corresponding relationship of the network port in device.
S703 establishes the network connection of the network port corresponding with received port information.
It should be noted that in practical applications, after the definition or update for completing local network port, server can be with It is locally generated the file that record has the network port Yu communication mode corresponding relationship, so that the server carries out looking into for the network port It is used when looking for.
Further, after obtaining the communication method information in the request message that client is sent, server can basis Record has the file of the corresponding relationship of the network port in communication method information and server in local, it is first determined the server In the network port corresponding with the communication method information which has;Later, one can be selected from the identified network port A network port for being connected to the network with the client obtains the port information of the network port, and the port is believed Breath is sent to client.
Client in the embodiment of the present invention can receive the port information of server transmission, and according to the port information, Establish the network connection of the network port corresponding with the port information.
It can be seen that the method provided in an embodiment of the present invention for establishing network connection, can send to server and carry The request message of communication method information, and the server is received after obtaining the request message, transmission is asked corresponding to this The port information of the network port of the communication method information in message is sought, and then is established corresponding with received port information The network connection of the network port.
Compared with prior art, the network port in server changes, and the embodiment of the present invention still is able to the clothes It is engaged in after device transmission request message, receives and identifies the port letter of the network port corresponding to the request message of server transmission Breath, and establish and be connected to the network with the network port for corresponding to the port information.
Corresponding to embodiment of the method shown in FIG. 1, the embodiment of the invention also provides a kind of devices for establishing network connection.
As shown in figure 8, a kind of device for establishing network connection provided in an embodiment of the present invention, is applied to server, it is described Server includes multiple network ports, the apparatus may include:
Message capturing module 801, for obtaining the request message of client transmission, the request message that the client is sent Carry the communication method information that the client is communicated with the server;
The first information obtains module 802, for according to the network-side in preset communication method information and the server The corresponding relationship of mouth obtains the communication method information corresponded in request message acquired in the message capturing module 801 The port information of the network port;
First information sending module 803 is sent for the first information to be obtained the port information obtained of module 802 To the client, so that the network port of the client and the port information for corresponding to this is established and is connected to the network.
It can be seen that the device provided in an embodiment of the present invention for establishing network connection, in the request for obtaining client transmission After message, it can determine according to the corresponding relationship of the network port in preset communication method information and server and correspond to institute It states the port information of the network port of the communication method information in request message, and identified port information is sent to described Client is connected to the network so that the client is established with the network port for corresponding to the port information.
Compared with prior art, the network port in server changes, and the embodiment of the present invention still is able to according to the visitor The request message that family end is sent determines the port information for corresponding to the network port of the request message, then by the port information It is sent to client, so that the two establishes network connection.
Optionally, in one embodiment of the invention, the first information as shown in Figure 9 obtains module 802, can wrap It includes:
Port determines submodule 802a, for according to the network port in preset communication method information and the server Corresponding relationship, determine the net for corresponding to the communication method information acquired in the message capturing module 801 in request message Network port;
Information acquisition submodule 802b is determined in the network port determined by submodule 802a for obtaining the port In the port information of a network port of idle state.
Optionally, in one embodiment of the invention, multiple network ports that the server includes carry class Type mark;When the device provided in an embodiment of the present invention for establishing network connection can be to increase on the basis of device shown in Fig. 8 Long statistical module 804 and port number increase module 805.
It should be noted that duration statistical module 804 and port number increase module 805 can both fill according to shown in Figure 10 The connection type set is attached, and can also be attached according to other connection types, the embodiment of the present invention does not limit this It is fixed.The function of increasing module 805 to duration statistical module 804 and port number below is described in detail.
Duration statistical module 804, for count all types of network ports in the first preset duration it is in running order when It is long;
Port number increases module 805, the port number of the network port for increasing target type, the target type It is more than port type belonging to the network port of the first preset threshold for operating time.
Optionally, in one embodiment of the invention, provided in an embodiment of the present invention to establish the device being connected to the network also It can be with statistical module 806 and the first output module 807 of accelerating on the basis of device shown in Fig. 8.
It should be noted that quantity statistics module 806 and the first output module 807 both can be according to Figure 11 shown devices Connection type is attached, and can also be attached according to other connection types, the embodiment of the present invention is not construed as limiting this.Under Function in face of quantity statistics module 806 and the first output module 807 is described in detail.
Quantity statistics module 806, for counting the quantity of the in running order network port;
First output module 807, the quantitative value for obtaining the quantity statistics module 806 statistics are output to display and set It is standby, so as to user can the port service condition to server be monitored.
Optionally, in one embodiment of the invention, provided in an embodiment of the present invention to establish the device being connected to the network also It can be to increase state information acquisition module 808 and the second output module 809 on the basis of device shown in Fig. 8.
It should be noted that state information acquisition module 808 and the second output module 809 can both be filled according to shown in Figure 12 The connection type set is attached, and can also be attached according to other connection types, the embodiment of the present invention does not limit this It is fixed.The function of state information acquisition module 808 and the second output module 809 is described in detail below.
State information acquisition module 808, for obtaining the status information of the network port;
Second output module 809, the state letter of the network port for getting the state information acquisition module 808 Breath be output to display equipment, so as to user can the port working state to server be monitored.
Optionally, in one embodiment of the invention, the communication mode of the client and the server is long connects Connect mode or short connection type;When the communication mode of the client and the server is long connection type, the present invention is real The device for applying the foundation network connection of example offer can be to increase monitoring modular 810, label mould on the basis of device shown in Fig. 8 Block 811, the second information acquisition module 812 and the second information sending module 813.
It should be noted that monitoring modular 810, mark module 811, the second information acquisition module 812 and the second information hair Send module 813 that can both be attached according to the connection type of Figure 13 shown device, can also according to other connection types into Row connection, the embodiment of the present invention are not construed as limiting this.Below to monitoring modular 810, mark module 811, the second information acquisition mould The function of block 812 and the second information sending module 813 is described in detail.
Monitoring modular 810, for monitoring the network connection in the second preset duration between the client and the network port Disconnection times;
Mark module 811, the disconnection times for monitoring the monitoring modular 810 reach the net of the second preset threshold Network port label is failure;
Second information acquisition module 812 corresponds to the client present communications mode for determining in the server , the unmarked network port for failure, obtain determined by the network port network port port information;
Second information sending module 813, for sending second information acquisition module 812 port information obtained To the client, it is connected to the network so that the client is established with the network port for corresponding to the port information.
Corresponding to embodiment of the method shown in Fig. 7, the embodiment of the invention also provides a kind of devices for establishing network connection.
As shown in figure 14, a kind of device for establishing network connection provided in an embodiment of the present invention, is applied to client, the dress It sets and may include:
Message transmission module 1401, for sending request message to server, the request message carries the client Hold the communication method information communicated with the server;
Information receiving module 1402 is obtaining transmitted by the message transmission module 1401 for receiving the server After request message, the port information of the network port corresponding to the communication method information of transmission;It is stored in the server The corresponding relationship of the network port in preset communication method information and the server;
Module 1403 is established in network connection, for establishing and port information received by the information receiving module 1402 The network connection of the corresponding network port.
It can be seen that the device provided in an embodiment of the present invention for establishing network connection, can send to server and carry The request message of communication method information, and the server is received after obtaining the request message, transmission is asked corresponding to this The port information of the network port of the communication method information in message is sought, and then is established corresponding with received port information The network connection of the network port.
Compared with prior art, the network port in server changes, and the embodiment of the present invention still is able to the clothes It is engaged in after device transmission request message, receives and identifies the port letter of the network port corresponding to the request message of server transmission Breath, and establish and be connected to the network with the network port for corresponding to the port information.
For device embodiment, since it is substantially similar to the method embodiment, related so being described relatively simple Place illustrates referring to the part of embodiment of the method.
For convenience of description, it is divided into various modules when description apparatus above with function to describe respectively.Certainly, implementing this The function of each module can be realized in the same or multiple software and or hardware when invention.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality For applying example, since it is substantially similar to the method embodiment, so being described relatively simple, related place is referring to embodiment of the method Part explanation.
Those of ordinary skill in the art will appreciate that all or part of the steps in realization above method embodiment is can It is completed with instructing relevant hardware by program, the program can store in computer-readable storage medium, The storage medium designated herein obtained, such as:ROM/RAM, magnetic disk, CD etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (14)

1. a kind of method for establishing network connection, is applied to server, the server includes multiple network ports, and feature exists In, including:
The request message that client is sent is obtained, the request message that the client is sent carries the client and the service The communication method information that device is communicated;The communication method information includes:The communication party of the client and the server Formula is long connection type or short connection type;
According to the corresponding relationship of the network port in preset communication method information and the server, obtains and correspond to described ask Seek the port information of the network port of the communication method information in message;
Port information obtained is sent to the client, so that the client and the network for corresponding to the port information Network connection is established in port;
Wherein, the corresponding relationship according to the network port in preset communication method information and the server, acquisition pair The port information of the network port of communication method information in request message described in Ying Yu, including:
There is the file of the corresponding relationship of the network port in communication method information and server according to record in local, determines the clothes The network port corresponding with the communication method information in business device;From the identified network port, one is selected to be used for and the visitor The network port that family end is connected to the network, and obtain the port information of the network port.
2. the method according to claim 1, wherein described according to preset communication method information and the service The corresponding relationship of the network port in device obtains the end of the network port of the communication method information corresponded in the request message Message breath, including:
According to the corresponding relationship of the network port in preset communication method information and the server, determines and correspond to described ask Seek the network port of the communication method information in message;
The port information for a network port being in idle condition in the network port determined by obtaining.
3. the method according to claim 1, wherein multiple network ports that the server includes carry Type identification;The method also includes:
Count the duration that all types of network ports are in running order in the first preset duration;
Increase the port number of the network port of target type, the target type is that operating time is more than the first preset threshold Port type belonging to the network port.
4. the method according to claim 1, wherein the method also includes:
Count the quantity of the in running order network port;
The obtained quantitative value of statistics is output to display equipment, so as to user can the port service condition to server supervise Control.
5. the method according to claim 1, wherein the method also includes:
Obtain the status information of the network port;
The status information for the network port that will acquire is output to display equipment, so that user can be to the port working of server State is monitored.
6. the method according to claim 1, wherein when the client and the communication mode of the server are When long connection type, the method also includes:
Monitor the network connection disconnection times in the second preset duration between the client and the network port;
It will be switched off number and reach the network port of the second preset threshold labeled as failure;
It determines in the server corresponding to the client present communications mode, the unmarked network port for failure, obtains The port information of a network port in the network port determined by obtaining;
The port information is sent to the client, so that the client is built with the network port for corresponding to the port information Vertical network connection.
7. a kind of method for establishing network connection, is applied to client, which is characterized in that including:
Request message is sent to server, the request message carries the communication that the client is communicated with the server Mode information;The communication method information includes:The communication mode of the client and the server be long connection type or Short connection type;
The server is received after obtaining the request message, the communication method information of transmission corresponded in the request message The network port port information;The network being stored in the server in preset communication method information and the server The corresponding relationship of port;
Establish the network connection of the network port corresponding with received port information;
Wherein, the port information of the network port of the communication method information determines in the following manner:Server is according to local Middle record has the file of the corresponding relationship of the network port in communication method information and server, determines logical with this in the server The corresponding network port of letter mode information;From the identified network port, one is selected to be used to carry out network with the client The network port of connection, and obtain the port information of the network port.
8. a kind of device for establishing network connection, is applied to server, the server includes multiple network ports, and feature exists In, including:
Message capturing module, for obtaining the request message of client transmission, the request message that the client is sent is carried The communication method information that the client is communicated with the server;The communication method information includes:The client with The communication mode of the server is long connection type or short connection type;
The first information obtains module, for corresponding with the network port in the server according to preset communication method information Relationship obtains the end of the network port of the communication method information corresponded in request message acquired in the message capturing module Message breath;
First information sending module, for first information acquisition module port information obtained to be sent to the client End is connected to the network so that the client is established with the network port for corresponding to the port information.
9. device according to claim 8, which is characterized in that the first information obtains module, including:
Port determines submodule, for closing according to preset communication method information is corresponding with the network port in the server System determines the network port of the communication method information corresponded in request message acquired in the message capturing module;
Information acquisition submodule is determined for obtaining the port and is in idle condition in the network port determined by submodule The port information of one network port.
10. device according to claim 8, which is characterized in that multiple network ports that the server includes carry There is type identification;Described device further includes:
Duration statistical module, for counting the duration that all types of network ports are in running order in the first preset duration;
Port number increases module, the port number of the network port for increasing target type, and the target type is work Duration is more than port type belonging to the network port of the first preset threshold.
11. device according to claim 8, which is characterized in that described device further includes:
Quantity statistics module, for counting the quantity of the in running order network port;
First output module, the quantitative value for counting the quantity statistics module are output to display equipment, so as to Family can the port service condition to server be monitored.
12. device according to claim 8, which is characterized in that described device further includes:
State information acquisition module, for obtaining the status information of the network port;
Second output module, the status information of the network port for getting the state information acquisition module are output to aobvious Show equipment, so as to user can the port working state to server be monitored.
13. device according to claim 8, which is characterized in that when the communication mode of the client and the server When for long connection type, described device further includes:
Monitoring modular, for monitoring the network connection disconnection time in the second preset duration between the client and the network port Number;
Mark module, for by the monitoring module monitors to disconnection times reach the second preset threshold the network port mark For failure;
Second information acquisition module, for determine in the server corresponding to the client present communications mode, do not mark It is denoted as the network port of failure, obtains the port information of a network port in the identified network port;
Second information sending module, for the second information acquisition module port information obtained to be sent to the client End is connected to the network so that the client is established with the network port for corresponding to the port information.
14. a kind of device for establishing network connection, is applied to client, which is characterized in that including:
Message transmission module, for sending request message to server, the request message carries the client and the clothes The communication method information that business device is communicated;The communication method information includes:The communication of the client and the server Mode is long connection type or short connection type;
Information receiving module, for receiving the server after obtaining request message transmitted by the message transmission module, What is sent corresponds to the port information of the network port of the communication method information in the request message;It is stored in the server The corresponding relationship of the network port in preset communication method information and the server;
Module is established in network connection, for establishing network-side corresponding with port information received by the information receiving module The network connection of mouth;
Wherein, the port information of the network port of the communication method information determines in the following manner:Server is according to local Middle record has the file of the corresponding relationship of the network port in communication method information and server, determines logical with this in the server The corresponding network port of letter mode information;From the identified network port, one is selected to be used to carry out network with the client The network port of connection, and obtain the port information of the network port.
CN201410472857.3A 2014-09-16 2014-09-16 A kind of method and device for establishing network connection Active CN104202334B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410472857.3A CN104202334B (en) 2014-09-16 2014-09-16 A kind of method and device for establishing network connection

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410472857.3A CN104202334B (en) 2014-09-16 2014-09-16 A kind of method and device for establishing network connection

Publications (2)

Publication Number Publication Date
CN104202334A CN104202334A (en) 2014-12-10
CN104202334B true CN104202334B (en) 2018-11-16

Family

ID=52087559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410472857.3A Active CN104202334B (en) 2014-09-16 2014-09-16 A kind of method and device for establishing network connection

Country Status (1)

Country Link
CN (1) CN104202334B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106303702A (en) * 2015-06-11 2017-01-04 阿里巴巴集团控股有限公司 Connection status inspection method, device and intelligent television system
CN105610924B (en) * 2015-12-24 2019-03-12 深圳市华讯方舟软件技术有限公司 A kind of method and apparatus of cloud desktop multinode connection
CN109347933B (en) * 2018-09-29 2021-07-20 卓米私人有限公司 Method and device for establishing connection
CN109495600B (en) * 2018-11-19 2022-04-29 北京知道创宇信息技术股份有限公司 Website access method and device and readable storage medium
CN111181807B (en) * 2019-12-26 2022-04-08 国汽(北京)智能网联汽车研究院有限公司 Communication interface device and multi-port communication interaction method
CN111586714B (en) * 2020-04-21 2021-07-20 珠海格力电器股份有限公司 Network port allocation method, device, electronic equipment and computer usable medium
CN113645294B (en) * 2021-08-06 2022-08-26 腾讯科技(深圳)有限公司 Message acquisition method and device, computer equipment and message transmission system
CN114866421B (en) * 2022-05-13 2024-05-14 西安广和通无线通信有限公司 Port management method, device, equipment and computer readable storage medium
CN115512481B (en) * 2022-09-22 2023-07-14 广东便捷神科技股份有限公司 Server data processing method networked with vending machine

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101583086A (en) * 2009-06-19 2009-11-18 广州市中海达测绘仪器有限公司 Method for controlling data interaction among mobile terminals and system thereof
CN102185856A (en) * 2011-03-22 2011-09-14 北京朗玛数联科技有限公司 Team organizing video method, device and system used in team organizing game
CN102572003A (en) * 2010-12-08 2012-07-11 中国电信股份有限公司 Method and system for acquiring and processing multiplexing address and port range

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5618886B2 (en) * 2011-03-31 2014-11-05 株式会社日立製作所 Network system, computer distribution apparatus, and computer distribution method
CN103095783B (en) * 2011-11-08 2015-10-14 阿里巴巴集团控股有限公司 A kind of method and device debugging Web application

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101583086A (en) * 2009-06-19 2009-11-18 广州市中海达测绘仪器有限公司 Method for controlling data interaction among mobile terminals and system thereof
CN102572003A (en) * 2010-12-08 2012-07-11 中国电信股份有限公司 Method and system for acquiring and processing multiplexing address and port range
CN102185856A (en) * 2011-03-22 2011-09-14 北京朗玛数联科技有限公司 Team organizing video method, device and system used in team organizing game

Also Published As

Publication number Publication date
CN104202334A (en) 2014-12-10

Similar Documents

Publication Publication Date Title
CN104202334B (en) A kind of method and device for establishing network connection
CN103944746B (en) A kind of method and device of two-node cluster hot backup
CN101953139B (en) DHCP in response to Internet connectedness initializes
CN101459534B (en) Network topology collecting method for tree shaped network and network equipment
CN105721318B (en) The method and apparatus of network topology are found in a kind of software defined network SDN
CN104467950B (en) A kind of acquisition methods and device of luminous power data
CN104272654B (en) For the adaptive method and apparatus quickly started in link aggregation
CN104301161B (en) Computational methods, computing device and the communication system of quality of service index
CN103731870B (en) The management method and device of monitor task
CN104320502B (en) Terminating gateway IP address distribution method, the method for data transfer, MME and system
CN110191059A (en) A kind of routing iinformation monitoring method and device
CN109842566A (en) A kind of dns resolution method and device
EP3217597A1 (en) Method and apparatus for performing an automatic bandwidth management in a communication network
CN106533803B (en) CPE configuration method and device based on TR069 agreement
CN106936729A (en) Control method, system and broadband access network system that a kind of terminal device is accessed
CN103109497B (en) For measuring the dynamic-configuration of the interconnect equipment of net neutral energy characteristic
CN108614450A (en) Mechanical system and its method under a kind of Internet of Things
CN105553762B (en) Communication means, system and related device between household electrical appliance and mobile terminal
CN103096361B (en) The exchange method of performance statistic and device in a kind of wireless local area network (WLAN) system
CN105306303B (en) The real-time monitoring system of failure and terminal network appliance based on terminal network appliance
CN104536926B (en) The control method and device of serial equipment
CN114416933A (en) Complaint processing method and device, electronic equipment and storage medium
CN108011870B (en) A kind of remote software online upgrading information automatic identification management method
EP2561646B1 (en) Apparatuses and methods for registering transmission capacities in a broadband access network
CN108667640B (en) Communication method and device, and network access system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 510623 3101-31063108-3110 house, Hua Xia Road, Tianhe District, Guangzhou, Guangdong.

Applicant after: Guangzhou cheetah Network Technology Co., Ltd.

Address before: 510623 01-B sixth unit, Guangzhou bank building, 30 Zhujiang East Road, Tianhe District, Guangzhou, Guangdong.

Applicant before: Kingsoft, Guangzhou network technology Co., Ltd

GR01 Patent grant
GR01 Patent grant