CN106301889B - A kind of port numbers rapid-setting method and system - Google Patents

A kind of port numbers rapid-setting method and system Download PDF

Info

Publication number
CN106301889B
CN106301889B CN201610603941.3A CN201610603941A CN106301889B CN 106301889 B CN106301889 B CN 106301889B CN 201610603941 A CN201610603941 A CN 201610603941A CN 106301889 B CN106301889 B CN 106301889B
Authority
CN
China
Prior art keywords
port numbers
occupied
memory
generated
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
CN201610603941.3A
Other languages
Chinese (zh)
Other versions
CN106301889A (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.)
TCL Communication Ningbo Ltd
Original Assignee
TCL Mobile Communication Technology Ningbo 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 TCL Mobile Communication Technology Ningbo Ltd filed Critical TCL Mobile Communication Technology Ningbo Ltd
Priority to CN201610603941.3A priority Critical patent/CN106301889B/en
Publication of CN106301889A publication Critical patent/CN106301889A/en
Application granted granted Critical
Publication of CN106301889B publication Critical patent/CN106301889B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0889Techniques to speed-up the configuration process
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/618Details of network addresses
    • H04L2101/663Transport layer addresses, e.g. aspects of transmission control protocol [TCP] or user datagram protocol [UDP] ports

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention discloses a kind of port numbers rapid-setting method and system, and when by detecting that process calls port numbers generating function, whether judgement has the corresponding port numbers of the process in memory, and the port numbers are used if the port numbers are unoccupied;In addition to this port numbers generating function is called to generate port numbers;The port numbers that one piece of region is used to store each process are reserved in memory, when a process executes for the first time, port numbers are generated by port numbers generating function, and judge whether the port numbers are occupied, continue to call port numbers generating function until generating a unappropriated port numbers if occupied;Using the port numbers and save the port numbers of the process;To which port numbers can quickly be arranged when there is when needing to establish connection with remote server into layer of application layer, and do not have to generate port numbers as now needing to call port numbers generating function in the art, to improve system execution efficiency.

Description

A kind of port numbers rapid-setting method and system
Technical field
The present invention relates to mobile terminal application field more particularly to a kind of port numbers rapid-setting method and systems.
Background technique
Mobile terminal is for network using more and more at present, and in the computer network reference model, transport layer is real Now data transmission end to end, the port further according to each application layer using the application of network is needed after transport layer obtains data Number data are distributed to again it is each by port numbers come specified process.There are multiple processes carrying out data using network in application layer Data delivery is given according to the port numbers in data packet when transport layer receives a data packet and uses the port numbers by transmission Process.
In the prior art, client computer (such as mobile terminal) is needed when consumer process establishes connection with server First oneself a port number is generated to mark this process, then port numbers are issued to the server for needing to establish connection;At this In, it needs to generate port numbers by calling port numbers generating function in the prior art when establishing connection every time, leads to port numbers Generating function is called frequently, and influences execution efficiency.
Therefore, the existing technology needs to be improved and developed.
Summary of the invention
In view of above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide a kind of port numbers rapid-setting method and it is System, it is intended to solve the problem of when quick setting port numbers when needing to establish connection with remote server into layer for having application layer.
Technical scheme is as follows:
A kind of port numbers rapid-setting method, wherein comprising steps of
A, the port numbers that one piece of region stores each process are reserved in memory;
B, whether real-time detection has the request of the assignment of port numbers of process;
C, when there are processes request assignment port numbers, if the process has been assigned port numbers, call the process corresponding Port numbers;
If D, the process is unallocated in memory there are port numbers, port numbers are generated for the process and are saved to memory In.
The port numbers rapid-setting method, wherein in the step B, by whether detecting port numbers generating function It is called, to determine whether there is process in request assignment of port numbers.
The port numbers rapid-setting method, wherein the step C includes:
C1, judge whether the corresponding port numbers of the process are occupied;
C2, when port numbers are occupied, generate unappropriated port numbers again for the process and replace original end It slogan and saves.
The port numbers rapid-setting method, wherein the step D includes:
D1, judge whether the port numbers generated are occupied;
D2, when newly-generated port numbers are occupied, then regenerate port numbers, until newly-generated port numbers not by When occupancy, the process and corresponding port numbers are saved.
System is quickly arranged in a kind of port numbers, wherein includes:
Memory module stores the port numbers of each process for reserving one piece of region in memory;
Whether detection module has the request of the assignment of port numbers of process for real-time detection;
Calling module, for when there is processes request assignment port numbers, if the process has been assigned port numbers, calling should The corresponding port numbers of process;
Distribution module then generates port numbers simultaneously for the process for having port numbers when the process is unallocated in memory It saves into memory.
System is quickly arranged in the port numbers, wherein is by detecting port numbers generating function in the detection module It is no called, to determine whether there is process in request assignment of port numbers.
System is quickly arranged in the port numbers, wherein the calling module includes:
First judging unit, for judging whether the corresponding port numbers of the process are occupied;
First generation unit, for generating unappropriated port numbers simultaneously for the process again when port numbers are occupied It replaces original port numbers and saves.
System is quickly arranged in the port numbers, wherein the distribution module includes:
Whether second judgment unit, the port numbers for judging to generate are occupied;
Second generation unit, for when newly-generated port numbers are occupied, then port numbers being regenerated, until new life At port numbers it is unoccupied when, save the process and corresponding port numbers.
The utility model has the advantages that the present invention by detect process call port numbers generating function when, judgement in memory whether There are the corresponding port numbers of the process, the port numbers are used if the port numbers are unoccupied;In addition to this call port numbers raw Port numbers are generated at function;Reserve the port numbers that one piece of region is used to store each process in memory, when a process for the first time When execution, port numbers is generated by port numbers generating function, and judge whether the port numbers are occupied, continue to call if occupied Port numbers generating function is until generating a unappropriated port numbers;Using the port numbers and save the port numbers of the process; To which port numbers can quickly be arranged when there is when needing to establish connection with remote server into layer of application layer, and picture is not had to It now needs that port numbers generating function is called to generate port numbers in the art, to improve system execution efficiency.
Detailed description of the invention
Fig. 1 is the step flow chart of port numbers rapid-setting method of the present invention.
Fig. 2 is the flow chart of the step S3 of port numbers rapid-setting method of the present invention.
Fig. 3 is the flow chart of the step S4 of port numbers rapid-setting method of the present invention.
Fig. 4 is the structural block diagram that system is quickly arranged in port numbers of the present invention.
Fig. 5 is the structural block diagram for the calling module that system is quickly arranged in port numbers of the present invention.
Fig. 6 is the structural block diagram for the distribution module that system is quickly arranged in port numbers of the present invention.
Specific embodiment
The present invention provides a kind of port numbers rapid-setting method and system, to make the purpose of the present invention, technical solution and effect Fruit is clearer, clear, and the present invention is described in more detail below.It should be appreciated that specific embodiment described herein is only Only to explain the present invention, it is not intended to limit the present invention.
Referring to Fig. 1, being the step flow chart of port numbers rapid-setting method of the present invention, the invention discloses one kind Port numbers rapid-setting method, wherein comprising steps of
S1, the port numbers that one piece of region stores each process are reserved in memory;
Whether S2, real-time detection have the request of the assignment of port numbers of process;
S3, when there is processes request assignment port numbers, if the process has been assigned port numbers, call the process corresponding Port numbers;
If S4, the process are unallocated in memory there are port numbers, port numbers are generated for the process and are saved to storage In device.
The invention discloses a kind of port numbers rapid-setting methods, specifically, in the prior art, consumer process and clothes When business device establishes connection, needs first oneself to generate a port number to mark this process, then port numbers are issued and need to establish The server of connection;Herein, it needs to generate port numbers in the prior art when establishing connection every time, leads to port numbers generating function The problem of being called frequently, influencing execution efficiency, the present invention store each process using reserved one piece of region in memory Port numbers, and after process distributed port numbers, the corresponding port numbers of the process can be stored in memory, real-time detection is whether Have the request of the assignment of port numbers of process, that is, whether have process need with server establish connection, when have process need and service When device connects, assignment of port numbers is requested, can search in memory whether the process has been assigned port numbers, when being assigned port After number, the corresponding port numbers and server is called to establish connection, and when process is not assigned port numbers in memory, New port numbers then are generated for the process, and process and port numbers pairing are stored, are saved in memory, it is convenient In the connection of next process, assignment of port numbers, the entire method and step of the present invention is more convenient compared with the prior art, more efficient.
Further, the port numbers rapid-setting method, wherein raw by detection port numbers in the step S2 Whether it is called at function, to determine whether there is process in request assignment of port numbers.The method of the invention, detected whether into Whether journey is called to realize in request assignment of port numbers by detection port numbers generating function, specifically, the port numbers are raw It is a mathematical function in the prior art at function, input includes several occupied port numbers, then by port Number generating function generates the port numbers of several port numbers not equal to input;When not input terminal slogan, port numbers are raw The port numbers of not no any restrictions are generated at function, conventionally, as frequent call, whole efficiency can be made inclined It is low, and resource is occupied, in the present invention, is searched in the port numbers for having distribution, do not need each process and all call life At function, improve work efficiency.
Further, as shown in Fig. 2, being the flow chart of the step S3 of port numbers rapid-setting method of the present invention, Wherein, the step S3 includes:
S301, judge whether the corresponding port numbers of the process are occupied;
S302, when port numbers are occupied, generate unappropriated port numbers again for the process and replace original It port numbers and saves.
The method of the invention, in step S3, when there is processes request assignment port numbers, if the process has been assigned port Number, then the corresponding port numbers of the process are called, specifically, can search in memory when there are processes request assignment port numbers The process sees whether the process has been assigned corresponding port numbers in memory, when there is assignment of port numbers, the process not In use, the port numbers may occupied by other processes, therefore, it is also desirable to whether detect the port numbers occupied, when this into When journey is occupied, which, which cannot reallocate, gives the process, therefore, it is necessary to again be process generation port numbers, and again Whether second of port numbers generated of detection are occupied, when the port that second generates is occupied, continue to generate, until generating Until unappropriated port numbers, and the process and corresponding unappropriated port numbers are saved, replaces original correspondence Port numbers can guarantee the corresponding process of each port numbers, not will lead to multiple processes one by above-mentioned judgment method Port numbers cause system errors, and the stability of system is higher.
Further, as shown in figure 3, being the flow chart of the step S4 of port numbers rapid-setting method of the present invention, Wherein, the step S4 includes:
S401, judge whether the port numbers generated are occupied;
S402, when newly-generated port numbers are occupied, then regenerate port numbers, until newly-generated port numbers not When occupied, the process and corresponding port numbers are saved.
In the method described in the present invention, in step s 4, if the process is unallocated in memory port numbers, for this Process generates port numbers and saves into memory, in process first time in use, not there is historical record in memory, looks into Corresponding less than process port numbers are ask, therefore, it is necessary to regenerate new port numbers, and the new port numbers generated, it needs Judge whether occupied by existing process, when not occupying, then storage process and port numbers are needed when occupying Port numbers are regenerated, when newly-generated port numbers are unoccupied, save the process and corresponding port numbers.
Present pre-ferred embodiments, specifically, the port numbers generating function are a mathematical function in the prior art, It includes several occupied port numbers that it, which is inputted, then generates one by port numbers generating function and is not equal to the several of input The port numbers of a port numbers;When not input terminal slogan, port numbers generating function generates the port numbers of not no any restrictions. In fact, port numbers generating function is a random number generation function, random number generated is limited certainly, is limited The integer between range 0 ~ 65535 allowed for port numbers.
Further, the invention also discloses a kind of port numbers, and system is quickly arranged, as shown in figure 4, for the system Structural block diagram, wherein include:
Memory module 100 stores the port numbers of each process for reserving one piece of region in memory;
Whether detection module 200 has the request of the assignment of port numbers of process for real-time detection;
Calling module 300, for if the process has been assigned port numbers, adjusting when there is processes request assignment port numbers With the corresponding port numbers of the process;
Distribution module 400 then generates port numbers for having port numbers when the process is unallocated in memory for the process And it saves into memory.The connection and use of the modules of the system of the invention, in method and step in detail Thin description, therefore, not repeat them here.
Further, system is quickly arranged in the port numbers, wherein passes through detection port in the detection module 200 Whether number generating function is called, to determine whether there is process in request assignment of port numbers.
Further, as shown in figure 5, the structural frames of the calling module of system are quickly arranged for port numbers of the present invention Figure, wherein the calling module 300 includes:
First judging unit 301, for judging whether the corresponding port numbers of the process are occupied;
First generation unit 302, for generating unappropriated port numbers again for the process when port numbers are occupied And it replaces original port numbers and saves.
Further, as shown in fig. 6, the structural frames of the distribution module of system are quickly arranged for port numbers of the present invention Figure, wherein the distribution module 400 includes:
Whether second judgment unit 401, the port numbers for judging to generate are occupied;
Second generation unit 402, for when newly-generated port numbers are occupied, then regenerating port numbers, until When newly-generated port numbers are unoccupied, the process and corresponding port numbers are saved.
In conclusion the present invention by detect process call port numbers generating function when, judgement in memory whether There are the corresponding port numbers of the process, the port numbers are used if the port numbers are unoccupied;In addition to this call port numbers raw Port numbers are generated at function;Reserve the port numbers that one piece of region is used to store each process in memory, when a process for the first time When execution, port numbers is generated by port numbers generating function, and judge whether the port numbers are occupied, continue to call if occupied Port numbers generating function is until generating a unappropriated port numbers;Using the port numbers and save the port numbers of the process; To which port numbers can quickly be arranged when there is when needing to establish connection with remote server into layer of application layer, and picture is not had to It now needs that port numbers generating function is called to generate port numbers in the art, to improve system execution efficiency.
It should be understood that the application of the present invention is not limited to the above for those of ordinary skills can With improvement or transformation based on the above description, all these modifications and variations all should belong to the guarantor of appended claims of the present invention Protect range.

Claims (6)

1. a kind of port numbers rapid-setting method, which is characterized in that comprising steps of
A, the port numbers that one piece of region stores each process are reserved in memory;
B, whether real-time detection has the request of the assignment of port numbers of process;
C, when there are processes request assignment port numbers, if the process has been assigned port numbers, the corresponding port of the process is called Number;
If D, the process is unallocated in memory there are port numbers, port numbers are generated for the process and are saved into memory;
In the step B, by detecting whether port numbers generating function is called, to determine whether there is process to distribute end in request Slogan.
2. port numbers rapid-setting method according to claim 1, which is characterized in that the step C includes:
C1, judge whether the corresponding port numbers of the process are occupied;
C2, when port numbers are occupied, generate unappropriated port numbers again for the process and replace original port numbers And it saves.
3. port numbers rapid-setting method according to claim 1, which is characterized in that the step D includes:
D1, judge whether the port numbers generated are occupied;
D2, when newly-generated port numbers are occupied, then port numbers are regenerated, until newly-generated port numbers are unoccupied When, save the process and corresponding port numbers.
4. system is quickly arranged in a kind of port numbers characterized by comprising
Memory module stores the port numbers of each process for reserving one piece of region in memory;
Whether detection module has the request of the assignment of port numbers of process for real-time detection;
Calling module, for if the process has been assigned port numbers, calling the process when there is processes request assignment port numbers Corresponding port numbers;
Distribution module then generates port numbers for the process and saves for having port numbers when the process is unallocated in memory Into memory;
By detecting whether port numbers generating function is called in the detection module, to determine whether there is process to distribute in request Port numbers.
5. system is quickly arranged in port numbers according to claim 4, which is characterized in that the calling module includes:
First judging unit, for judging whether the corresponding port numbers of the process are occupied;
First generation unit, for generating unappropriated port numbers again for the process and replacing when port numbers are occupied Fall original port numbers and saves.
6. system is quickly arranged in port numbers according to claim 4, which is characterized in that the distribution module includes:
Whether second judgment unit, the port numbers for judging to generate are occupied;
Second generation unit, for when newly-generated port numbers are occupied, then port numbers being regenerated, until newly-generated When port numbers are unoccupied, the process and corresponding port numbers are saved.
CN201610603941.3A 2016-07-28 2016-07-28 A kind of port numbers rapid-setting method and system Active CN106301889B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610603941.3A CN106301889B (en) 2016-07-28 2016-07-28 A kind of port numbers rapid-setting method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610603941.3A CN106301889B (en) 2016-07-28 2016-07-28 A kind of port numbers rapid-setting method and system

Publications (2)

Publication Number Publication Date
CN106301889A CN106301889A (en) 2017-01-04
CN106301889B true CN106301889B (en) 2019-10-18

Family

ID=57662908

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610603941.3A Active CN106301889B (en) 2016-07-28 2016-07-28 A kind of port numbers rapid-setting method and system

Country Status (1)

Country Link
CN (1) CN106301889B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108932153A (en) * 2018-07-06 2018-12-04 杭州涂鸦信息技术有限公司 A kind of method and apparatus that more Docker examples dynamically distribute host port
CN109032806B (en) * 2018-07-30 2021-05-14 华为技术有限公司 Service scheduling method and device for container

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101222406A (en) * 2006-12-14 2008-07-16 华耀环宇科技有限公司 Dynamic system and method for virtual private network (VPN) application level content routing using dual-proxy method
CN103023789A (en) * 2012-12-05 2013-04-03 北方工业大学 Method for accessing private network server in internet
CN103746977A (en) * 2013-12-27 2014-04-23 东软熙康健康科技有限公司 Connection method and device for Linux server
CN104660453A (en) * 2015-03-20 2015-05-27 上海斐讯数据通信技术有限公司 Server port number consulting method and system
CN105450679A (en) * 2014-08-06 2016-03-30 杭州海康威视系统技术有限公司 Method and system for performing data cloud storage

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4297792B2 (en) * 2004-01-08 2009-07-15 株式会社リコー Web server embedded business equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101222406A (en) * 2006-12-14 2008-07-16 华耀环宇科技有限公司 Dynamic system and method for virtual private network (VPN) application level content routing using dual-proxy method
CN103023789A (en) * 2012-12-05 2013-04-03 北方工业大学 Method for accessing private network server in internet
CN103746977A (en) * 2013-12-27 2014-04-23 东软熙康健康科技有限公司 Connection method and device for Linux server
CN105450679A (en) * 2014-08-06 2016-03-30 杭州海康威视系统技术有限公司 Method and system for performing data cloud storage
CN104660453A (en) * 2015-03-20 2015-05-27 上海斐讯数据通信技术有限公司 Server port number consulting method and system

Also Published As

Publication number Publication date
CN106301889A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
CN108512890B (en) Container cloud platform resource scheduling method and system based on rack sensing
CN105516347A (en) Method and device for load balance allocation of streaming media server
CN102655503A (en) Resource allocation using shared resource pools
US10425273B2 (en) Data processing system and data processing method
CN115277566B (en) Load balancing method and device for data access, computer equipment and medium
CN112465615B (en) Method, device and system for processing bill data
CN106301889B (en) A kind of port numbers rapid-setting method and system
CN110912972A (en) Service processing method, system, electronic equipment and readable storage medium
CN103595736B (en) Access request treating method and apparatus in video monitoring system
CN104793982A (en) Method and device for establishing virtual machine
CN110602004A (en) Supervision data reporting, electronic device, equipment and computer readable storage medium
CN103067486A (en) Big-data processing method based on platform-as-a-service (PaaS) platform
CN105847169B (en) A kind of method and device for flow control
CN102685257A (en) Data synchronous processing system, data synchronous processing method and server system
CN103810038A (en) Method and device for transferring virtual machine storage files in HA cluster
CN113885794A (en) Data access method and device based on multi-cloud storage, computer equipment and medium
CN105657009A (en) Object gateway load balancing system and method, and cross-region object gateway storage system
CN113360321A (en) Micro-service retry calling method and device, electronic equipment and storage medium
CN102546652B (en) System and method for server load balancing
WO2017118129A1 (en) Spectrum resource sharing method and apparatus
CN102868594B (en) Method and device for message processing
CN102368708A (en) Control method and system of data transmission of network conference
CN115794423A (en) Management method and device of intelligent machine room, electronic equipment and storage medium
CN113568891B (en) Distributed ID generation method, device, server and readable storage medium
CN102158416B (en) Method and equipment for processing messages based on memory allocation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Yu Bin

Inventor after: Yang Weiqin

Inventor after: Kong Qingde

Inventor after: Li Hongyi

Inventor after: Wu Shuangqing

Inventor before: Yu Bin

Inventor before: Yang Weiqin

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201027

Address after: 6 building, No. 999, Lane 315100, sailing Road, hi tech Zone, Zhejiang, Ningbo, 5

Patentee after: TCL COMMUNICATION (NINGBO) Co.,Ltd.

Address before: 10 building, No. 999, Lane 315100, sailing Road, hi tech Zone, Zhejiang, Ningbo, 5

Patentee before: TCL mobile communication technology (Ningbo) Co.,Ltd.