Embodiment
In the form of embodiments of the invention, first scheme is the simplest form.
1st step, transfers to shared device by the port numbers that will use when internal computer is connected to self and network data exchange rule (TCP or UDP).
Such as, because most shared device implicit IP address is 192.168.0.1, thus, with http: // 192.168.0.1/dynamicpf.htm? port=110 & protocol=TCP calls out together.
2nd step, after shared device distributes one in unappropriated port numbers, by the IP address of distributed port numbers and internal computer, is increased to port repeat catalogue from the port numbers of internal computer transmission and network data exchange rule.
3rd step, the port numbers of dynamic assignment is back to internal computer by shared device.
When the port numbers that will not use, return mistake.
4th step, internal computer detects the port numbers of the shared device whether port numbers that returns uses for port repeat.
Pattern of the present invention
For the connection between computer, the present invention is specifically described.First term is defined as follows.Shared device: network shared device of the present invention.
Internal computer: the network equipment with the individual IP address being present in shared device inside or the program run thereon.
External computer: be present in the network equipment of shared device outside or the program in upper operation.
External server: the server with the public ip address being present in shared device outside.
Gateway: set the device by being connected to both sides, in the present invention, in order to be connected to internal computer, by the transfer of data of both sides to the device of the other side.
In order to dynamic assignment port numbers, there is the method for several exchange message between shared device and internal computer.
At this, be described for four kinds of methods.
The first, the method for shared device and transceiving data is connected to from internal computer.
Because most shared device can be connected to World Wide Web (WWW) from internal computer, thus, be described for the method for the particular webpage of calling out shared device.
First, only when allow dynamic port forward, be connected to the web page server of shared device, to use port forwarding function, and shared device arrange in interface activate dynamic port forward.
1st step, the port numbers used when internal computer being connected to self and network data exchange rule (TCP or UDP) transfer to shared device.
Such as, because most shared device implicit IP address is 192.168.0.1, therefore, with http: // 192.168.0.1/dynamicpf.htm? port=110 & protocol=TCP calls out together.
2nd step, the IP address of the internal computer be connected with distributed port numbers, the port numbers transmitted by internal computer and network data exchange rule are increased to port repeat catalogue distribute one in unappropriated port numbers after by shared device.
3rd step, the port numbers of dynamic assignment is back to internal computer by shared device.
When there is not the port numbers that will use, return mistake.
4th step, internal computer detects the port numbers that the returns port numbers of shared device whether for using at port repeat.
Use the present invention, be described for the method connected in outside.
1st step, the internal computer of dynamic assignment receiving port number is connected to external server and transmits the id information that can identify self and the port repeat port numbers of distributing, the IP address that external server stores the shared device connected and the port numbers transmitted and id information.
2nd step, external computer is connected to external server and transmits the ID of the computer that will connect, and external server returns IP address and the port numbers of shared device from id information retrieval.
3rd step, when external computer is connected to IP address and the port numbers of returned reception, be connected to the port repeat port of shared device, shared device maps to IP address and the port numbers of the internal computer of respective end slogan in port repeat catalog search, and is connected to the port numbers of the internal computer of specifying.
Close the power supply of internal computer or break wired, or when wireless sharing device, when the cut-outs such as the WiFi scope of internal computer disengaging shared device are connected with the physical property of corresponding computer, remove corresponding port in port repeat catalogue and forward.
When certain internal computer uses the fixed ip address of shared device, even if reconnect because of computer, also use identical IP address, thus, without the need to removing port repeat.
According to other network data exchange rule except HTTP described above, be connected to shared device, order-assigned port as described above.
The second, according to formulae discovery disclosed in the IP address of internal computer and port numbers, and port can be distributed.
Such as, internal computer generally has about 250 addresses from 192.168.0.2, thus, by forward at dynamic port used port numbers be restricted to 100 time, according to formula such as the port numbers=port numbers * 256+IP addresses of dynamic assignment, shared device internal computer, relative to each self port numbers, can have about 25, one in 000 port numbers mouth, the port numbers that internal computer will be able to use from self calculates the port repeat port numbers of shared device.
3rd, the parallel port triggering function using shared device.
Although the port triggering function application target being present in a part of shared device is different, but when internal computer utilizes of being preset in the port numbers of shared device and is connected to shared device, one is dispensed in default port numbers, and the IP address of the internal computer be connected with the port numbers of distributing and port numbers are increased to port repeat catalogue.
This port triggering function following similar shown in, during assignment of port numbers, shared device external computer can be connected to the specific computer of shared device inside.
1st step, the port numbers of internal computer appointment self and network data exchange rule, attempt by shared device to be connected to external server.
2nd step, shared device assignment of port numbers, is connected to external server for the request because of internal computer, and the IP address of the internal computer be connected with distributed port numbers and port numbers, network data exchange rule are increased to port repeat catalogue.
3rd step, when internal computer is connected to external server, the port numbers of internal computer None-identified shared device, but because external server can identify IP address and the port numbers of the shared device being connected to self, be back to shared device internal computer by being connected to the IP address of the shared device of self and port numbers or port numbers.
4th step, the information returned transfers to internal computer by shared device, and internal computer detects the port numbers whether port numbers that returns is the shared device being used in port repeat.
Now, in order to obtain port numbers, when the external server connected is identical server with the external server illustrated in described utilization embodiment, internal computer is after being connected to external server, transmission can identify that self id information, external server store IP address and the port numbers of the id information transmitted and the shared device being connected to self.
Now, because shared device internal computer is without the need to again transferring to external server by the IP address of shared device and port numbers, without the need to IP address and the port numbers of shared device must be known, and, correspondingly also without the need to must receiving port number be returned.
And, in order to wait for the connection from outside, the port of shared device and internal computer is necessary for holding state (answering), because of without the need to being holding state by the port translation in using, after internal computer returns receiving port number, terminate the connection with external server, when internal computer terminates to connect, shared device also terminates to connect at once.
Afterwards, originally internal computer utilization is connected to the port numbers of self of shared device, the port numbers of shared device self distribution, and the connection from outside is converted to the holding state (answering) of wait.
And, external computer also can be connected to internal computer, as online browsing etc., internal computer also can be connected to the various servers being present in shared device outside, but now without the need to setting port repeat, and, when connecting at every turn and set port repeat, also can be inadequate because of port, and restriction is used in the scope of the port numbers of the internal computer of port repeat.
4th, gateway apparatus is located at shared device inside, and obtains the effects such as dynamic port forwarding.
First, utilize port repeat or the DMZ function of shared device, when being connected to the particular port of shared device, set be connected to gateway.
1st step, internal computer is connected to external server and transmits the port repeat port numbers of id information and the shared device that self can identify, the individual IP address of self, the port numbers that will use when being connected to self, further, the external server storage public ip address being connected to the shared device of self and the information transmitted.
2nd step, external computer is connected to external server and transmits the ID of the computer that will connect, external server is returned shared device IP address by id information and port numbers, the IP address of internal computer that be connected and port numbers.
3rd step, when external computer is connected to IP address and the port numbers of the shared device returning reception, by shared device port forwarding function and be connected to gateway.
4th step, after connection, external computer transmits IP address and the port numbers of the internal computer that will connect, and gateway is connected to the port of internal computer according to the information of transmission.
5th step, be connected to after internal computer terminates, gateway plays the intermediation data of transmission being transferred to the other side by both sides.
Now, the ID of internal computer and the IP address of shared device and port numbers can be identified in outside server stores, the ID of internal computer and the individual IP address of internal computer and port numbers can be identified in gateway storage, cross after shared device is connected to gateway outside computer expert, transmission ID, further, gateway also can make to be connected to from ID the internal computer mapped it.
Also this functional module and shared device can be fabricated to one.
Above-mentionedly be illustrated as a specific embodiment of the present invention, various transformation can be carried out to her.
Industrial applicibility
The present invention is because can automatically set port repeat information, and therefore in DHCP use procedure, no matter be the IP address modification of internal computer or increase another internal computer, user sets port repeat without the need to each arranging on interface of shared device.
Further, when increasing the use of the mobile terminal devices such as smart mobile phone, communication speed can be increased by the direct connection between terminal equipment, and the load of server can be reduced, and the overall traffic can be reduced.