CN107329713B - Cross-network-segment printing method and system - Google Patents

Cross-network-segment printing method and system Download PDF

Info

Publication number
CN107329713B
CN107329713B CN201710499872.0A CN201710499872A CN107329713B CN 107329713 B CN107329713 B CN 107329713B CN 201710499872 A CN201710499872 A CN 201710499872A CN 107329713 B CN107329713 B CN 107329713B
Authority
CN
China
Prior art keywords
mobile terminal
address
data packet
udp data
terminal
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
CN201710499872.0A
Other languages
Chinese (zh)
Other versions
CN107329713A (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.)
Fujian Huisibo Digital Technology Co ltd
Original Assignee
Fuzhou Huisibo Information 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 Fuzhou Huisibo Information Technology Co ltd filed Critical Fuzhou Huisibo Information Technology Co ltd
Priority to CN201710499872.0A priority Critical patent/CN107329713B/en
Publication of CN107329713A publication Critical patent/CN107329713A/en
Application granted granted Critical
Publication of CN107329713B publication Critical patent/CN107329713B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1236Connection management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/1253Configuration of print job parameters, e.g. using UI at the client
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1278Dedicated interfaces to print systems specifically adapted to adopt a particular infrastructure
    • G06F3/1285Remote printer device, e.g. being remote from client or server
    • G06F3/1288Remote printer device, e.g. being remote from client or server in client-server-printer device configuration
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07GREGISTERING THE RECEIPT OF CASH, VALUABLES, OR TOKENS
    • G07G5/00Receipt-giving machines
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Abstract

The invention provides a cross-network-segment printing method and a system, wherein the method comprises the following steps: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology; the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; and the PC terminal prints the document to be printed according to the printing parameters. The invention realizes that the mobile terminal in the father network can print the document through the PC end, improves the printing convenience in different network segments and realizes the sharing of printers in different network segments.

Description

Cross-network-segment printing method and system
Technical Field
The invention relates to the technical field of mobile communication, in particular to a cross-network-segment printing method and a cross-network-segment printing system.
Background
With the rapid development of intelligent mobile terminals and the wider application scenes, in an office environment, data or files stored in the intelligent mobile terminals need to be used for printing; when a file stored in a mobile terminal is to be printed, the file is generally copied to a PC terminal equipped with a printer through a data line and the like, and the printing is performed by the PC terminal, which is inconvenient in operation.
In an office scene, in a double network segment in an internal local area network, one network segment is assumed to be a subnet of the other network segment, a PC end provided with a printer is in one network segment, and an intelligent mobile terminal is in the other network segment.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the invention provides a convenient, quick and efficient cross-network-segment printing method and system.
In order to solve the above-described problem, the present invention provides a method for printing across network segments, comprising the steps of:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
s2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
s3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
s4: and the PC terminal prints the document to be printed according to the printing parameters.
The invention also provides a cross-network segment printing system, which comprises a PC end in a subnet and a mobile terminal in a father network, wherein the PC end comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and the processor realizes the following steps when executing the program:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
s2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
s3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
s4: and the PC terminal prints the document to be printed according to the printing parameters.
The invention has the beneficial effects that:
the method and the device have the advantages that the mobile terminal in the father network can acquire the information of the printer on the PC terminal in the subnet, after the TCP connection is established between the PC terminal and the mobile terminal, the mobile terminal can send the name of the printer selected by a user and the corresponding printing parameters to the PC terminal, and the PC terminal prints the document to be printed uploaded by the mobile terminal according to the printing parameters; the invention realizes that the mobile terminal in the father network can print the document on the mobile terminal through the PC end, improves the printing convenience in different network segments and realizes the printing sharing of the printer connected with the PC end in the subnet.
Drawings
Fig. 1 is a schematic diagram of the main steps of a cross-web printing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of a cross-web segment printing according to an embodiment of the present invention;
FIG. 3 is a schematic cross-web printing system configuration according to an embodiment of the present invention;
description of reference numerals:
1. a PC terminal; 2. a mobile terminal; 3. a memory; 4. a processor.
Detailed Description
In order to explain technical contents, objects and effects of the present invention in detail, the following detailed description is given with reference to the accompanying drawings in conjunction with the embodiments.
Referring to fig. 1 to 2, the present invention provides a method for printing across network segments, comprising the following steps:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
s2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
s3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
s4: and the PC terminal prints the document to be printed according to the printing parameters.
From the above description, the invention realizes that the mobile terminal in the father network can acquire the information of the printer on the PC terminal in the subnet, after the TCP connection is established between the PC terminal and the mobile terminal, the mobile terminal can send the printer name selected by the user and the corresponding printing parameter to the PC terminal, and the PC terminal prints the document to be printed uploaded by the mobile terminal according to the printing parameter; the invention realizes that the mobile terminal in the father network can print the document on the mobile terminal through the PC end, improves the printing convenience in different network segments and realizes the printing sharing of the printer connected with the PC end in the subnet.
Further, the S1 specifically includes:
sending a first UDP data packet by a PC end in a subnet, wherein the source address of the first UDP data packet is the IP address of the PC end, and the destination address of the first UDP data packet is the IP address of a mobile terminal, so that the NAT equipment changes the source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and performing group sending on the second UDP data packet; the mobile terminal in the father network receives the second UDP data packet and sends a third UDP data packet to NAT equipment, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal; the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC end to obtain a fourth UDP data packet; the PC end receives a fourth UDP data packet sent by the NAT equipment; the first address is a legal communication address in a parent network segment.
It can be known from the above description that the mobile terminal in the parent network cannot directly access the PC terminal in the subnet, so the mobile terminal cannot directly initiate a print request to the PC terminal, and by the above method, the PC terminal in the subnet sends a UDP packet in a group through the NAT device, the mobile terminal in the parent network can receive the UDP packet, and if the mobile terminal has a print request, the UDP packet is sent to the PC terminal through the NAT device, and the UDP packet includes a UDP connection request, so that the mobile terminal in the parent network can send a UDP print request to the PC terminal in the subnet.
Further, the S2 specifically includes:
the PC terminal sends a fifth UDP data packet to NAT equipment, wherein the source address of the fifth UDP data packet is the IP address of the PC terminal, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, and the fifth UDP data packet comprises the IP address of the PC terminal, a TCP port and printer information; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer; and the NAT equipment changes the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, and sends the sixth UDP data packet to the mobile terminal, so that the mobile terminal analyzes the UDP data packet to obtain the IP address, the TCP port and the printer information of the PC terminal.
As can be seen from the above description, when the PC receives a UDP packet sent by the mobile terminal, where the UDP packet includes a UDP connection request, and after responding to the connection request, the IP address, the TCP port, and the printer information of the PC are sent to the mobile terminal through the above method, so that the mobile terminal can perform a printing operation across network segments.
Further, the S3 specifically includes:
the PC end and the mobile terminal establish TCP communication connection;
acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the PC terminal stores the printing parameters, acquiring the document to be printed uploaded by the mobile terminal.
As is apparent from the above description, the above method enables the mobile terminal in the parent network to perform the printing operation through the PC terminal in the child network.
Further, "the PC end establishes a TCP communication connection with the mobile terminal" specifically includes:
the PC end receives the IP address and the TCP port of the mobile terminal sent by the mobile terminal through a UDP protocol and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to the TCP connection request initiated by the mobile terminal, the PC terminal initiates a TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by the PC terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
As can be seen from the above description, with the above method, the TCP connection between the mobile terminal in the parent network and the PC terminal in the subnet is implemented, so that the cross-network segment printing is implemented, and the convenience of printing is improved.
Referring to fig. 3, the printing system across network segments provided by the present invention includes a PC terminal 1 in a subnet and a mobile terminal 2 in a parent network, where the PC terminal 1 includes a memory 3, a processor 4 and a computer program stored in the memory 3 and capable of running on the processor 4, and the processor 4 implements the following steps when executing the computer program:
s1: establishing UDP communication connection with the mobile terminal through a network address translation technology;
s2: sending IP address, TCP port and printer information of a PC end to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
s3: after TCP communication connection is established with the mobile terminal, a document to be printed and printing parameters sent by the mobile terminal are obtained; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
s4: and printing the document to be printed according to the printing parameters.
Further, in the printing system across web segments, the step S1 is specifically:
sending a first UDP data packet, wherein the source address of the first UDP data packet is the IP address of a PC end, and the destination address of the first UDP data packet is the IP address of a mobile terminal, so that NAT equipment changes the source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and group sending the second UDP data packet; the mobile terminal in the father network receives the second UDP data packet and sends a third UDP data packet to NAT equipment, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal; the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC end to obtain a fourth UDP data packet; and the PC end receives a fourth UDP data packet sent by the NAT equipment.
Further, in the printing system across web segments, the step S2 is specifically:
sending a fifth UDP data packet to NAT equipment, wherein the source address of the fifth UDP data packet is the IP address of the PC end, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, and the fifth UDP data packet comprises the IP address of the PC end, a TCP port and printer information; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer; and the NAT equipment changes the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, and sends the sixth UDP data packet to the mobile terminal, so that the mobile terminal analyzes the UDP data packet to obtain the IP address, the TCP port and the printer information of the PC terminal.
Further, in the printing system across web segments, the step S3 is specifically:
establishing TCP communication connection with the mobile terminal;
acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the request information is stored, acquiring the document to be printed uploaded by the mobile terminal.
Further, the cross-network-segment printing system, which establishes a TCP communication connection with the mobile terminal, specifically includes:
receiving an IP address and a TCP port of the mobile terminal sent by the mobile terminal through a UDP protocol, and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to a TCP connection request initiated by a mobile terminal, initiating the TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by a PC (personal computer) terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
Referring to fig. 1, a first embodiment of the present invention is:
the invention provides a cross-network-segment printing method, which comprises the following steps:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
the S1 specifically includes:
sending a first UDP data packet by a PC end in a subnet, wherein the source address of the first UDP data packet is the IP address of the PC end, and the destination address of the first UDP data packet is the IP address of a mobile terminal, so that the NAT equipment changes the source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and performing group sending on the second UDP data packet; the mobile terminal in the father network receives the second UDP data packet and sends a third UDP data packet to NAT equipment, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal; the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC end to obtain a fourth UDP data packet; and the PC end receives a fourth UDP data packet sent by the NAT equipment.
S2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
the S2 specifically includes:
the PC terminal sends a fifth UDP data packet to NAT equipment, wherein the source address of the fifth UDP data packet is the IP address of the PC terminal, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, and the fifth UDP data packet comprises the IP address of the PC terminal, a TCP port and printer information; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer; and the NAT equipment changes the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, and sends the sixth UDP data packet to the mobile terminal, so that the mobile terminal analyzes the UDP data packet to obtain the IP address, the TCP port and the printer information of the PC terminal.
S3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
the S3 specifically includes:
the PC end and the mobile terminal establish TCP communication connection;
the specific steps of establishing the TCP communication connection between the PC end and the mobile terminal are as follows:
the PC end receives the IP address and the TCP port of the mobile terminal sent by the mobile terminal through a UDP protocol and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to the TCP connection request initiated by the mobile terminal, the PC terminal initiates a TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by the PC terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
Acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the PC terminal stores the printing parameters, acquiring the document to be printed uploaded by the mobile terminal.
S4: and the PC terminal prints the document to be printed according to the printing parameters.
From the above description, the invention realizes that the mobile terminal in the father network can print the document on the mobile terminal through the PC end, improves the convenience of printing in different network segments, and realizes the printing sharing of the printer connected with the PC end in the subnet.
Referring to fig. 2, the second embodiment of the present invention is:
firstly, a PC end starts TCP (transmission control protocol) service, if the PC end is positioned in a subnet, the PC end sends a UDP (user datagram protocol) packet to a network segment where a POS machine is positioned in a group, because the PC is positioned in the subnet, NAT can generate a communication address mapping relation, namely when the PC accesses a terminal of a certain IP of a network segment of a father network (an upper layer), the NAT converts a source communication address of the UDP packet into a legal communication address of the network segment of the upper layer, and a target communication address is kept unchanged, so that a data packet can reach the terminal of the network segment of the upper layer, a POS machine positioned in the father network can receive the UDP packet of the PC, meanwhile, the POS machine can access the PC of the subnet by using the source communication address of the UDP packet, and the PC can receive a UDP request;
similarly, if the POS machine is in the subnet and the PC end is in the father network segment, when the POS machine needs to acquire the printer information, the UDP packet can be directly sent to the network segment where the PC end is located in a group, and the PC can receive the UDP request of the POS machine;
after receiving the UDP request, the PC end can send the printer information, the IP address of the PC end and the TCP port to the POS machine through a UDP communication protocol by using the source communication address of the UDP packet; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
after receiving the UDP packet, the POS machine stores the source communication address of the UDP, the IP address and the TCP port of the PC end and simultaneously presents printer information to a user for selection in a list form;
when the POS machine is ready to print, the POS machine starts TCP service, and according to the previously stored UDP source communication address, IP address and TCP port information of the POS machine are converted by a UDP packet through an NAT address and then can be sent to a PC end, in addition, the POS machine sends the UDP packet and simultaneously sends a TCP connection request to the PC, if the PC is positioned in a subnet and cannot receive the TCP request, the PC can use the IP and TCP port of the POS machine received by the UDP communication, and send TCP connection to the POS machine, and as long as the TCP connection is established, the POS machine and the PC can carry out interactive processing of printing;
after the POS machine establishes TCP connection with the PC end, the POS machine sends the selected file, the printer and the printing parameters to the PC end, wherein the printing parameters are the name of the printer selected by a user on the POS machine, the corresponding IP address and the TCP port; and after the PC terminal prepares for receiving the file, the POS machine is informed to upload the file, and after the file is uploaded, the PC terminal prints the file according to the printing parameters.
Referring to fig. 3, a third embodiment of the present invention is:
the invention provides a cross-network-segment printing system, which comprises a PC end and a mobile terminal, wherein the PC end is positioned in a subnet, the mobile terminal is positioned in a father network, the PC end comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, and the processor executes the program to realize the following steps:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
the S1 specifically includes:
sending a first UDP data packet by a PC end in a subnet, wherein the source address of the first UDP data packet is the IP address of the PC end, and the destination address of the first UDP data packet is the IP address of a mobile terminal, so that the NAT equipment changes the source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and performing group sending on the second UDP data packet; the mobile terminal in the father network receives the second UDP data packet and sends a third UDP data packet to NAT equipment, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal; the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC end to obtain a fourth UDP data packet; and the PC end receives a fourth UDP data packet sent by the NAT equipment.
S2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer;
the S2 specifically includes:
the PC terminal sends a fifth UDP data packet to NAT equipment, wherein the source address of the fifth UDP data packet is the IP address of the PC terminal, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, and the fifth UDP data packet comprises the IP address of the PC terminal, a TCP port and printer information; the printer information comprises the name of the printer, an IP address and a TCP port corresponding to the name of the printer; and the NAT equipment changes the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, and sends the sixth UDP data packet to the mobile terminal, so that the mobile terminal analyzes the UDP data packet to obtain the IP address, the TCP port and the printer information of the PC terminal.
S3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal; the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
the S3 specifically includes:
the PC end and the mobile terminal establish TCP communication connection;
the specific steps of establishing the TCP communication connection between the PC end and the mobile terminal are as follows:
the PC end receives the IP address and the TCP port of the mobile terminal sent by the mobile terminal through a UDP protocol and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to the TCP connection request initiated by the mobile terminal, the PC terminal initiates a TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by the PC terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
Acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the PC terminal stores the printing parameters, acquiring the document to be printed uploaded by the mobile terminal.
S4: and the PC terminal prints the document to be printed according to the printing parameters.
In summary, the invention realizes that the mobile terminal in the father network can acquire the information of the printer on the PC terminal in the subnet, after the PC terminal establishes the TCP connection with the mobile terminal, the mobile terminal can send the printer name selected by the user and the corresponding printing parameters to the PC terminal, and the PC terminal prints the document to be printed uploaded by the mobile terminal according to the printing parameters; the invention realizes that the mobile terminal in the father network can print the document on the mobile terminal through the PC end, improves the printing convenience in different network segments and realizes the printing sharing of the printer connected with the PC end in the subnet.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to other related technical fields, are included in the scope of the present invention.

Claims (6)

1. A method of printing across web segments, comprising the steps of:
s1: establishing UDP communication connection between a PC end in a subnet and a mobile terminal in a father network by a network address translation technology;
s2: the PC terminal sends the IP address, the TCP port and the printer information of the PC terminal to the mobile terminal through a UDP communication protocol;
s3: after the PC terminal establishes TCP communication connection with the mobile terminal, acquiring a document to be printed and printing parameters sent by the mobile terminal;
s4: the PC terminal prints the document to be printed according to the printing parameters;
the S1 specifically includes:
the method comprises the steps that a PC end in a subnet sends a first UDP data packet to an NAT device, so that the NAT device changes a source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and the second UDP data packet is sent in a group mode, wherein the source address of the first UDP data packet is an IP address of the PC end, and a destination address of the first UDP data packet is an IP address of a mobile terminal;
the mobile terminal in the parent network receives the second UDP data packet and sends a third UDP data packet to NAT equipment, so that the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC terminal, and a fourth UDP data packet is obtained, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal;
the PC end receives a fourth UDP data packet sent by the NAT equipment;
the S2 specifically includes:
the PC terminal sends a fifth UDP data packet to the NAT device, so that the NAT device changes the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, the sixth UDP data packet is sent to the mobile terminal, the mobile terminal analyzes the sixth UDP data packet to obtain the IP address, the TCP port and the printer information of the PC terminal, the source address of the fifth UDP data packet is the IP address of the PC terminal, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, the fifth UDP data packet comprises the IP address, the TCP port and the printer information of the PC terminal, and the printer information comprises the name of the printer, the IP address and the TCP port corresponding to the name of the printer.
2. The method for printing across a web segment according to claim 1, wherein the S3 specifically is:
the PC end and the mobile terminal establish TCP communication connection;
acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the PC terminal stores the printing parameters, acquiring the document to be printed uploaded by the mobile terminal.
3. The method according to claim 1 or claim 2, wherein the step of establishing the TCP communication connection between the PC and the mobile terminal specifically includes:
the PC end receives the IP address and the TCP port of the mobile terminal sent by the mobile terminal through a UDP communication protocol and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to the TCP connection request initiated by the mobile terminal, the PC terminal initiates a TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by the PC terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
4. A cross-network segment printing system comprising a PC terminal in a subnet and a mobile terminal in a parent network, the PC terminal comprising a memory, a processor and a computer program stored in the memory and operable on the processor, wherein the processor implements the following steps when executing the computer program:
s1: establishing UDP communication connection with the mobile terminal through a network address translation technology;
s2: sending IP address, TCP port and printer information of a PC end to the mobile terminal through a UDP communication protocol;
s3: after TCP communication connection is established with the mobile terminal, a document to be printed and printing parameters sent by the mobile terminal are obtained;
s4: printing the document to be printed according to the printing parameters;
in step S1, the processor, when executing the computer program, is specifically:
sending a first UDP data packet to NAT equipment, so that the NAT equipment changes a source address in the first UDP data packet into a preset first address to obtain a second UDP data packet, and performing group sending on the second UDP data packet, wherein the source address of the first UDP data packet is an IP address of a PC (personal computer) end, and the destination address of the first UDP data packet is an IP address of a mobile terminal;
receiving a fourth UDP data packet sent by the NAT equipment;
in step S1, the mobile terminal in the parent network performs the following steps:
receiving the second UDP data packet, and sending a third UDP data packet to NAT equipment, so that the NAT equipment changes the destination address of the third UDP data packet into the IP address of the PC end, and a fourth UDP data packet is obtained, wherein the destination address of the third UDP data packet is the first address, and the source address of the third UDP data packet is the IP address of the mobile terminal;
in step S2, the processor, when executing the computer program, is specifically:
sending a fifth UDP data packet to NAT equipment to enable the NAT equipment to change the source address of the fifth UDP data packet into the first address to obtain a sixth UDP data packet, sending the sixth UDP data packet to a mobile terminal to enable the mobile terminal to analyze the sixth UDP data packet to obtain the IP address, the TCP port and printer information of the PC end, wherein the source address of the fifth UDP data packet is the IP address of the PC end, the destination address of the fifth UDP data packet is the IP address of the mobile terminal, the fifth UDP data packet comprises the IP address, the TCP port and the printer information of the PC end, and the printer information comprises the name of a printer and the IP address and the TCP port corresponding to the name of the printer.
5. The printing system across web segments as claimed in claim 4, wherein said S3 is specifically:
establishing TCP communication connection with the mobile terminal;
acquiring printing request information sent by a mobile terminal, wherein the printing request information comprises a name of a document to be printed and printing parameters, and the printing parameters are the name of a printer selected by a user on the mobile terminal, a corresponding IP address and a corresponding TCP port;
and after the request information is stored, acquiring the document to be printed uploaded by the mobile terminal.
6. The printing system of claim 4 or claim 5, wherein the "establishing a TCP communication connection with the mobile terminal" is specifically:
receiving an IP address and a TCP port of the mobile terminal sent by the mobile terminal through a UDP communication protocol and a TCP connection request initiated by the mobile terminal; the TCP connection request initiated by the mobile terminal is a TCP connection request initiated by the mobile terminal according to the IP address of the PC terminal and the TCP port;
after responding to a TCP connection request initiated by a mobile terminal, initiating the TCP connection request to the mobile terminal according to the IP address and the TCP port of the mobile terminal, so that after the mobile terminal responds to the TCP connection request initiated by a PC (personal computer) terminal, the PC terminal establishes TCP communication connection with the mobile terminal.
CN201710499872.0A 2017-06-27 2017-06-27 Cross-network-segment printing method and system Active CN107329713B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710499872.0A CN107329713B (en) 2017-06-27 2017-06-27 Cross-network-segment printing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710499872.0A CN107329713B (en) 2017-06-27 2017-06-27 Cross-network-segment printing method and system

Publications (2)

Publication Number Publication Date
CN107329713A CN107329713A (en) 2017-11-07
CN107329713B true CN107329713B (en) 2020-08-18

Family

ID=60198255

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710499872.0A Active CN107329713B (en) 2017-06-27 2017-06-27 Cross-network-segment printing method and system

Country Status (1)

Country Link
CN (1) CN107329713B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112449003A (en) * 2020-10-19 2021-03-05 北京三快在线科技有限公司 Printing equipment network communication connection method and device and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262478A (en) * 2008-04-10 2008-09-10 杭州华三通信技术有限公司 Method and device for penetrating NAT
CN103179120A (en) * 2013-03-21 2013-06-26 天闻数媒科技(北京)有限公司 Method and system for realizing printing of mobile device
CN103491016A (en) * 2012-06-08 2014-01-01 百度在线网络技术(北京)有限公司 Method, system and device for transferring source address in UDP load balancing system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101262478A (en) * 2008-04-10 2008-09-10 杭州华三通信技术有限公司 Method and device for penetrating NAT
CN103491016A (en) * 2012-06-08 2014-01-01 百度在线网络技术(北京)有限公司 Method, system and device for transferring source address in UDP load balancing system
CN103179120A (en) * 2013-03-21 2013-06-26 天闻数媒科技(北京)有限公司 Method and system for realizing printing of mobile device

Also Published As

Publication number Publication date
CN107329713A (en) 2017-11-07

Similar Documents

Publication Publication Date Title
US20200059976A1 (en) IoT DEVICE CONNECTIVITY, DISCOVERY, AND NETWORKING
CN111294399B (en) Data transmission method and device
US9563389B2 (en) Image processing system, gateway apparatus, server apparatus, method of controlling gateway apparatus, method of controlling server apparatus, program for controlling gateway apparatus, and program for controlling server apparatus wherein the job includes an operation related to the job
US7836164B2 (en) Extensible network discovery subsystem
US20100150169A1 (en) Dynamic Adaptation Service
CN107613037B (en) Domain name redirection method and system
EP2975824B1 (en) Data terminal upgrade device and method
US20230291706A1 (en) Method for accessing network, media gateway, electronic device and storage medium
WO2019134595A1 (en) Configuration system, client device, embedded device configuration method, and storage medium
US20120287817A1 (en) Apparatus, method and computer program product for replicating settings information
CN104376090A (en) Screen synchronization equipment of browser in computing equipment and mobile terminal
US7023847B2 (en) Network address translation based mobility management
CN111711705B (en) Method and device for realizing network connection based on bidirectional NAT (network Address translation) by proxy node
CN112333017A (en) Service configuration method, device, equipment and storage medium
JP2019036923A (en) Information processing apparatus, program, and control method
CN107329713B (en) Cross-network-segment printing method and system
CN106570045B (en) Data operation control method and system and user terminal
JP6521762B2 (en) HTTP server, control method therefor, image forming apparatus and program
US9565058B2 (en) Method of connecting a device to a network, a device connecting system, and a program
CN107483593B (en) Bidirectional transparent proxy method and system
CN104219257A (en) Web real-time communication method, system, server and client
EP3079328B1 (en) Media resource sharing method, shared server and shared system
CN115174310B (en) PDN dialing and configuration method, system, device, equipment and storage medium
CN105516121B (en) The method and system that AC is communicated with AP in WLAN
US20150242176A1 (en) Determining optimal rendering systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: Room 201-9, Zone C, No. 18 Guanri Road, Phase II, Software Park, Torch High tech Zone, Xiamen City, Fujian Province, 361000

Patentee after: Fujian Huisibo Digital Technology Co.,Ltd.

Address before: No. 89 Software Avenue, Tongpan Road, Gulou District, Fuzhou City, Fujian Province, 350000. 510, Floor 5, 34 #, Zone C, Fuzhou Software Park

Patentee before: FUZHOU HUISIBO INFORMATION TECHNOLOGY Co.,Ltd.

CP03 Change of name, title or address