Summary of the invention
The invention provides a kind of FTP mode configuration method, data transmission method and equipment, in order to reduce based on the dependence of the transfer of data of FTP to NAT device.
FTP mode configuration method provided by the invention is applied to include the network system of ftp server and ftp client, and this method comprises:
After ftp server receives the register requirement message of ftp client, confirm the networking structure of this ftp server and this ftp client according to the address information of carrying in this register requirement message;
Said ftp server is said ftp client configuration FTP pattern according to the networking structure of determining; Wherein, If said ftp server is positioned at public network, said ftp client is positioned at private network; Then being said ftp client configuration PASV pattern, if said ftp server is positioned at private network, said ftp client is positioned at public network, then is said ftp client configuration PORT pattern;
Said ftp server returns response message to said ftp client, wherein carries the indication information of the FTP pattern of promising this ftp client configuration, disposes corresponding FTP pattern to indicate said ftp client.
Ftp server provided by the invention comprises:
Receiver module is used to receive the register requirement message of ftp client;
Determination module is used for confirming according to the address information that said register requirement message carries the networking structure of this ftp server and this ftp client;
Distribution module is used for according to the networking structure of determining, and is said ftp client configuration FTP pattern; Wherein, If said ftp server is positioned at public network, said ftp client is positioned at private network; Then being said ftp client configuration PASV pattern, if said ftp server is positioned at private network, said ftp client is positioned at public network, then is said ftp client configuration PORT pattern;
Sending module is used for returning response message to said ftp client, wherein carries the indication information of the FTP pattern of promising this ftp client configuration, disposes corresponding FTP pattern to indicate said ftp client.
The data transmission method of the FTP that realizes based on said method provided by the invention comprises:
Ftp client sends register requirement to ftp server, wherein carries address information;
Said ftp client receives the response that carries FTP pattern indication information that said ftp server returns, and disposes corresponding FTP pattern according to this FTP pattern indication information;
When said ftp client need be from said ftp server file in download, the FTP pattern according to configuration on it adopted corresponding FTP pattern from said ftp server file in download.
Ftp client equipment provided by the invention comprises:
Sending module is used for sending register requirement to ftp server, wherein carries address information;
Receiver module is used to receive the response that carries FTP pattern indication information that said ftp server returns; Wherein, Said ftp server is said ftp client configuration FTP pattern, wherein according to the networking structure of determining; If said ftp server is positioned at public network, said ftp client is positioned at private network; Then being said ftp client configuration PASV pattern, if said ftp server is positioned at private network, said ftp client is positioned at public network, then is said ftp client configuration PORT pattern;
Configuration module is used for disposing corresponding FTP pattern according to said FTP pattern indication information;
The FTP module is used for when needs during from said ftp server file in download, and the FTP pattern according to configuration on it adopts corresponding FTP pattern from said ftp server file in download.
Compared with prior art, useful technique effect of the present invention comprises:
Confirm that according to the register requirement message of ftp client own networking structure with this client distributes corresponding FTP pattern for this client through ftp server: when ftp server is positioned at public network, ftp client is positioned at private network; Then be ftp client configuration PASV pattern; When ftp server is positioned at private network, ftp client is positioned at public network; Then, support the NATALG function, promptly do not support under the situation of NATALG function at NAT device thereby need not NAT device for ftp client configuration PORT pattern; Can realize that client carries out FTP from server and download, reduce based on the dependence of the transfer of data of FTP to NAT device.
Embodiment
Below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
Referring to Fig. 1, the FTP pattern configurations that provides for the embodiment of the invention and carry out the schematic flow sheet of transfer of data based on the FTP pattern of configuration, as shown in the figure, this flow process can comprise:
When step 101, ftp client are registered to ftp server, after ftp server receives the register requirement of ftp client, confirm the networking structure of this ftp server and this ftp client according to the source address of carrying in this register requirement and destination address.
Wherein, the networking structure of ftp server and ftp client can comprise following several kinds of situation:
Situation 1:FTP server is positioned at public network, and ftp client is positioned at private network;
Situation 2:FTP server is positioned at private network, and ftp client is positioned at public network;
Situation 3:FTP server is positioned at private network, and ftp client is positioned at private network;
Situation 4:FTP server is positioned at private network, and ftp client is positioned at private network.
Step 102, ftp server are this ftp client configuration FTP pattern according to networking structure own and this ftp client.
Concrete; If ftp server is positioned at public network, ftp client is positioned at private network; Then ftp server is a ftp client configuration PASV pattern, if ftp server is positioned at private network, ftp client is positioned at public network, then ftp server is a ftp client configuration PORT pattern; Like this, NAT device need not to support or need not to start the FTPALG function.If ftp server and ftp client all are positioned at private network or all are positioned at public network, then to the FTP pattern no requirement (NR) that ftp client adopted, promptly ftp server both can be the also configurable PASV pattern of ftp client configuration PORT pattern.
Step 103, ftp server will be notified to ftp client for the FTP pattern of ftp client configuration, return to ftp client as can the indication information of the FTP pattern that disposes for ftp client being carried on registration reply message.
Step 104, ftp client is according to the FTP pattern of this this equipment of notice configuration.
Concrete, if ftp client disposed acquiescence FTP pattern before receiving this notice, then notify indicated FTP pattern according to this, upgrade the acquiescence FTP pattern of being somebody's turn to do; If ftp client did not dispose acquiescence FTP pattern before receiving this notice, then notify indicated FTP pattern configurations to be acquiescence FTP pattern this.
Step 105 when ftp client need be from the ftp server file in download, according to the FTP pattern of configuration on it, adopts corresponding manner from the ftp server file in download.
The above embodiment of the present invention; Can be according to the networking situation of ftp server and ftp client; Self adaptation is that ftp client distributes the FTP pattern, thereby does not support under the situation of FTP ALG function at NAT device, and the FTP pattern that ftp client also can pass through configuration is from the ftp server file in download.Its principle is following:
Ftp server is positioned at public network, when ftp client is positioned at private network, is ftp client configuration PASV pattern, like this; When ftp client need be from the FTP file in download; Be to initiate connection request by the ftp server of public network side, its payload segment carries the public network address and the port numbers of this ftp server, and this payload segment need not to carry out ALG and handles; Address and port numbers that ftp client can carry according to the payload segment of this connection request message are set up FTP with ftp server and are connected;
Ftp server is positioned at private network, when ftp client is positioned at public network, is ftp client configuration PORT pattern, like this; When ftp client need be from the FTP file in download; Be to initiate connection request by the ftp client of public network side, its payload segment carries the public network address and the port numbers of this ftp client, and this payload segment need not to carry out ALG and handles; Address and port numbers that ftp server can carry according to the payload segment of this connection request message are set up FTP with ftp client and are connected;
When ftp server all is positioned at private network or all is positioned at public network, no matter for ftp client configuration PORT pattern still is the PASV pattern, can not pass through NAT device and carry out network address translation, no matter which end initiate connection request by, the opposite end all can be set up FTP with it and be connected.
Be example below with the video monitoring system, the above-mentioned flow process of the embodiment of the invention is described in detail.
Existing video monitoring system mainly is made up of following elementary cell: EC, VM, MS (Media Switch; The exchange of media server), IPSAN (Internet Protocol Storage Area Network; Storage area network), DM (Data Management Server, data management server), DC (Decoder, decoder), VC (Video Client; And corresponding software management system and web-transporting device videoconference client) etc..When terminal equipment such as EC, DC adds video monitoring system, at first will be to server registrations such as VM.
Based on above-mentioned video monitoring system framework, Fig. 2 shows EC in the VM registration process, and VM is the flow process of EC configuration FTP pattern, and this flow process can comprise:
Step 201, EC sends logon message to VM.
Step 202, VM extracts the IP address that this header and payload segment carry after receiving the logon message of EC transmission.
It is (following convenient for describing to include source IP address and purpose IP address in the IP head of this logon message; Source IP address in the heading is called IP1; Purpose IP address in the heading is called IP2), the Session Initiation Protocol part FROM/TO field of this logon message payload segment carries source IP address (convenient for describing, that this IP address is called IP3); Carry purpose IP address (convenient for describing, that this IP address is called IP4) in Session Initiation Protocol part Request-Line field.
Step 203~206, VM judges networking structure own and this EC according to the IP address that extracts, as, among own and the EC which at public network, which is at private network, and disposes the FTP pattern according to judged result for this EC.
In this step; VM is through the source IP address with Session Initiation Protocol part in source IP address in the message IP head and the message load; And the purpose IP address of Session Initiation Protocol part compares in purpose IP address in the message IP head and the message load, draw EC whether at private network and VM whether at private network.
Concrete, if EC and VM in same network, logon message need not to carry out the NAT conversion, thereby the source IP address in the IP head and purpose IP address be real ip address, IP1 equals IP3 at this moment, IP2 equals IP4.In such cases, VM is that EC distributes PORT pattern or PASV pattern (step 204).
If at private network, then logon message can be revised the source IP address in the IP head by NAT device to VM at public network, EC, the private network source IP address that is about in the IP head is revised as public network IP address, and this moment, IP1 was not equal to IP3, and IP2 equals IP4.In such cases, VM is that EC distributes PASV pattern (step 205).
If at public network, then logon message can be revised the purpose IP address in the IP head by NAT device to VM at private network, EC, the private network purpose IP address modification that is about in the IP head is a public network IP address, and this moment, IP1 equaled IP3, and IP2 is not equal to IP4.In such cases, VM is that EC distributes PORT pattern (step 206).
Step 207, VM sends the register response message to this EC, wherein carries the indication information into the FTP pattern of this EC configuration.
Step 208 is after EC receives the register response message, according to the acquiescence FTP pattern of wherein indicated this equipment of FTP pattern configurations.
When EC need carry out software upgrading, set up FTP according to the acquiescence FTP pattern of configuration on it with VM and be connected, and FTP connection the carrying out software download through setting up, to accomplish upgrading.It is set up, and FTP connects and the FTP downloading process is identical with prior art, repeats no more at this.
Along with the development of video monitoring system, terminal equipment possibly need through the FTP mode from a plurality of server file in download.For the ease of later expansion; In another embodiment of the present invention; Client device is initiated registration to each server; And after receiving the indication information of the FTP pattern of distributing for this client device that each server returns through register response, can on client device, generate the adaptive list item of FTP, promptly corresponding to a plurality of adaptive patterns of a plurality of ftp servers.Client device earlier through this list item of inquiry, is confirmed the FTP pattern that oneself need use when file in download, use this pattern to carry out file then and download.Table 1 shows a kind of instance of FTP self adaptation list item.
Table 1
Server |
The FTP adaptive pattern |
Server 1 |
PASV (Passive Mode) |
Server 2 |
PORT (aggressive mode) |
Server 3 |
PORT (aggressive mode) |
...... |
...... |
Wherein, server 1,2,3...... can be the information that server identification or address etc. can the unique identification servers.
Can find out through above description; The IP address of VM through carrying in the SIP logon message that compares front end EC; Judge that EC still is that the VM server is in private network in private network; Then according to judged result notice EC configuration FTP pattern, so that EC need not NAT device and launches NAT ALG function setting up with VM when FTP is connected.
Need to prove that above-mentioned flow process only is that example is described with the video monitoring system, those skilled in the art should be able to understand, and above-mentioned technological thought is applied to the networking of other operation system, equally can realize the object of the invention.
Based on identical technical conceive, the embodiment of the invention also provides a kind of server and client side's equipment that can be applicable to above-mentioned flow process.
Referring to Fig. 3, the structural representation of the ftp server that provides for the embodiment of the invention, this ftp server can be but be not limited to the server in the video monitoring system that this ftp server can comprise:
Receiver module 301 is used to receive the register requirement message of ftp client;
Determination module 302 is used for confirming according to the address information that said register requirement message carries the networking structure of this ftp server and this ftp client;
Distribution module 303 is used for according to the networking structure of determining, and is said ftp client configuration FTP pattern; Wherein, If said ftp server is positioned at public network, said ftp client is positioned at private network; Then being said ftp client configuration PASV pattern, if said ftp server is positioned at private network, said ftp client is positioned at public network, then is said ftp client configuration PORT pattern;
Sending module 304 is used for returning the register response message to said ftp client, wherein carries the indication information of the FTP pattern of promising this ftp client configuration, disposes corresponding FTP pattern to indicate said ftp client.
Further; Distribution module 303 also is used for: if the networking structure that determination module 302 is determined is: said ftp server and said ftp client all are positioned at private network or all are positioned at public network, then are in said ftp client configuration PASV pattern and the PORT pattern any one.
Concrete, determination module 302 specifically is used for: extract an IP address and the 2nd IP address of said register requirement message IP head, and the 3rd IP address of this message payload segment and the 4th IP address; Wherein, first and third IP address is a source IP address, and second, four IP addresses are purpose IP address; The IP address that relatively extracts; And confirm the networking structure of said ftp server and said ftp client according to comparative result; Wherein, If an IP address is different with the 3rd IP address, the 2nd IP address is identical with the 4th IP address, then said ftp server is positioned at public network, said ftp client is positioned at private network; If an IP address is identical with the 3rd IP address, the 2nd IP address is different with the 4th IP address, then said ftp server is positioned at private network, said ftp client is positioned at public network; If an IP address is identical with the 3rd IP address, the 2nd IP address is identical with the 4th IP address, then said ftp server and said ftp client are positioned at consolidated network.
Referring to Fig. 4, the structural representation of the ftp client equipment that provides for the embodiment of the invention, this ftp client equipment can be but be not limited to the terminal equipment in the video monitoring system that this ftp client equipment can comprise:
Sending module 401 is used for sending register requirement to ftp server, wherein carries address information;
Receiver module 402 is used to receive the register response that carries FTP pattern indication information that said ftp server returns; Wherein, Said ftp server is said ftp client configuration FTP pattern, wherein according to the networking structure of determining; If said ftp server is positioned at public network, said ftp client is positioned at private network; Then being said ftp client configuration PASV pattern, if said ftp server is positioned at private network, said ftp client is positioned at public network, then is said ftp client configuration PORT pattern;
Configuration module 403 is used for disposing corresponding FTP pattern according to said FTP pattern indication information;
FTP module 404 is used for when needs during from said ftp server file in download, and the FTP pattern according to configuration on it adopts corresponding FTP pattern from said ftp server file in download.
Dispose ftp server tabulation in the above-mentioned ftp client, be used to write down ftp server and the FTP pattern information of this ftp server for this ftp client distribution.Accordingly, configuration module 403 can store FTP pattern information of carrying in the said response message and said ftp server in the said FTP tabulation into; FTP module 404 can be inquired about said FTP tabulation when said ftp client need be from said ftp server file in download, adopt the FTP pattern corresponding with said ftp server from said ftp server file in download.
Through the description of above execution mode, those skilled in the art can be well understood to the present invention and can realize by the mode that software adds essential general hardware platform, can certainly pass through hardware, but the former is better execution mode under a lot of situation.Based on such understanding; The part that technical scheme of the present invention contributes to prior art in essence in other words can be come out with the embodied of software product; This computer software product is stored in the storage medium, comprise some instructions with so that a station terminal equipment (can be mobile phone, personal computer; Server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
The above only is a preferred implementation of the present invention; Should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; Can also make some improvement and retouching, these improvement and retouching also should be looked protection scope of the present invention.