WO2017036305A1 - 数据连接的建立方法、服务端及移动终端 - Google Patents

数据连接的建立方法、服务端及移动终端 Download PDF

Info

Publication number
WO2017036305A1
WO2017036305A1 PCT/CN2016/095681 CN2016095681W WO2017036305A1 WO 2017036305 A1 WO2017036305 A1 WO 2017036305A1 CN 2016095681 W CN2016095681 W CN 2016095681W WO 2017036305 A1 WO2017036305 A1 WO 2017036305A1
Authority
WO
WIPO (PCT)
Prior art keywords
client
server
address
connection
response message
Prior art date
Application number
PCT/CN2016/095681
Other languages
English (en)
French (fr)
Inventor
王永亮
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to US15/756,916 priority Critical patent/US10693967B2/en
Priority to EP16840734.4A priority patent/EP3334095B1/en
Publication of WO2017036305A1 publication Critical patent/WO2017036305A1/zh

Links

Images

Classifications

    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • 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/148Migration or transfer of sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses

Definitions

  • the present invention relates to the field of mobile communications, and in particular, to a method for establishing a data connection, a server, and a mobile terminal.
  • some network elements track connections between devices. If there is no message on the connection for more than the threshold time, the connection will be disconnected. However, some devices usually need to send messages in time (that is, devices need to maintain long connections), and the messages sent may exceed the threshold time, for example, the message sent by the server of the push system to the client of the push system. The above disconnection method may cause the server to fail to send a message to the client in time, which may affect the performance of the push system.
  • a heartbeat message is usually sent between a device (eg, a server and a client), and the heartbeat message refers to a periodic packet sent between two devices, and most of the time Segments, there is no useful message interaction between the server and the client, which causes waste of network traffic resources, connection resources and server resources.
  • the embodiment of the invention provides a method for establishing a data connection, a server and a mobile terminal, which can effectively reduce the number of long connections between devices, thereby achieving the purpose of saving network resources.
  • a method for establishing a data connection comprising:
  • the first client sends a first connection request to the server, where the first connection request includes the first address of the first client;
  • the server searches for a second client from a preset storage unit according to the first address of the first client, where the preset storage unit is configured to store all connections established with the server. a first address and a second address of the client and all the clients, where the second client is a client belonging to the same local area network as the first client;
  • the server finds the second client, reading the second address of the second client, and returning a first response message to the first client, where the first response message includes the first The second address of the second client;
  • the first client establishes with the second client according to the second address of the second client End of the connection.
  • the first connection request further includes a second address of the first client
  • the method further includes:
  • the server does not find the second client, storing the second address of the first client in the preset storage unit, and returning a second response message to the first client;
  • the first client establishes a connection with the server according to the received second response message.
  • the method further includes:
  • the server performs data transmission with the first client via the second client.
  • a method for establishing a data connection comprising:
  • the server receives a first connection request sent by the first client, where the first connection request includes a first address of the first client;
  • a second client Searching, according to the first address of the first client, a second client from a preset storage unit, where the preset storage unit is configured to store all clients and all clients that have established a connection with the server a first address and a second address of the client, where the second client is a client that belongs to the same local area network as the first client;
  • the first response message is used to indicate that the first client establishes a connection with the second client.
  • the first connection request further includes a second address of the first client
  • the method further includes:
  • the second address of the first client is stored in the preset storage unit, and a connection with the first client is established.
  • the method further includes:
  • the server performs data transmission with the first client via the second client.
  • the method further includes:
  • the third client is a client that belongs to the same local area network as the first client;
  • the server performs data transmission with the first client via the third client.
  • the method further includes:
  • the server performs data transmission with the first client via the fourth client.
  • a method for establishing a data connection comprising:
  • the first client sends a first connection request to the server, where the first connection request includes the first address of the first client;
  • the server Receiving a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is a client that belongs to the same local area network as the first client;
  • the method further includes:
  • the method further includes:
  • the first client performs data transmission with the server via the second client.
  • the method further includes:
  • the first client performs data transmission with the server via the third client.
  • the method when the connection address of the second client changes or the server is When the second client disconnects, the method further includes:
  • the first client performs data transmission with the server via the fourth client.
  • a server in a fourth aspect, includes: a receiving unit, a searching unit, and a reading unit;
  • the receiving unit is configured to receive a first connection request sent by the first client, where the first connection request includes a first address of the first client;
  • the searching unit is configured to search for a second client from a preset storage unit according to the first address of the first client received by the receiving unit, where the preset storage unit is used to store and
  • the server has established a first address and a second address of all the clients connected to the client, and the second client is a client belonging to the same local area network as the first client;
  • the reading unit is configured to: if the searching unit finds the second client, read the second address of the second client;
  • the sending unit is configured to return a first response message to the first client, where the first response message includes a second address of the second client, and the first response message is used to indicate the first
  • the client establishes a connection with the second client.
  • the server further includes: Saving unit
  • the saving unit is configured to: if the searching unit does not find the second client, store the second address of the first client in the preset storage unit, and establish a relationship with the first client End of the connection.
  • the server further includes: a first transmission unit;
  • the first transmission unit is configured to perform data transmission with the first client via the second client.
  • the server further includes: a first indication unit and a Two transmission unit;
  • the receiving unit is further configured to receive a third connection request sent by the first client;
  • the searching unit is further configured to: search for a third client from the preset storage unit, where the third client is a client that belongs to the same local area network as the first client;
  • the first indication unit is configured to: if the searching unit finds the third client, instruct the first client to establish a connection with the third client;
  • the second transmission unit is further configured to perform data transmission with the first client via the third client.
  • the server further includes: a second indication unit and a third transmission unit;
  • the receiving unit is further configured to receive a fourth connection request sent by the first client;
  • the searching unit is further configured to: search for a fourth client from the preset storage unit according to the fourth connection request received by the receiving unit, where the fourth client is the first client
  • the client belongs to the same local area network
  • the second indication unit is configured to: if the searching unit finds the fourth client, instruct the first client to establish a connection with the fourth client;
  • the third transmission unit is configured to perform data transmission with the first client via the fourth client.
  • a fifth aspect provides a mobile terminal, where the mobile terminal includes: a sending unit, a receiving unit, and an establishing unit;
  • the sending unit is configured to send a first connection request to the server, where the first connection request includes a first address of the mobile terminal;
  • the receiving unit is configured to receive a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is the same as the mobile terminal LAN client;
  • the establishing unit is configured to establish a connection with the second client according to the first response message received by the receiving unit.
  • the receiving unit is further configured to receive a second response message sent by the server, where the second response message does not include the second client The second address of the end;
  • the establishing unit is further configured to establish a connection with the server according to the second response message received by the receiving unit.
  • the mobile terminal further includes: a first transmission unit;
  • the first transmission unit is configured to perform data transmission with the server by using the second client.
  • the mobile terminal further includes: a second transmission unit;
  • the sending unit is further configured to send a third connection request to the server;
  • the receiving unit is further configured to receive a third response message sent by the server, where the third response message includes a second address of the third client, where the third client belongs to the same local area network as the mobile terminal Client
  • the establishing unit is further configured to establish a connection with the third client according to the third response message received by the receiving unit;
  • the second transmission unit is configured to perform data transmission with the server by using the third client.
  • the mobile terminal further includes: a third transmission unit;
  • the sending unit is further configured to send a fourth connection request to the server;
  • the receiving unit is further configured to receive a fourth response message sent by the server, where the fourth The response message includes a second address of the fourth client, where the fourth client is a client that belongs to the same local area network as the mobile terminal;
  • the establishing unit is further configured to establish a connection with the fourth client according to the fourth response message received by the receiving unit;
  • the third transmission unit is configured to perform data transmission with the server by using the fourth client.
  • a server in a sixth aspect, includes: a receiver, a processor, a memory, a communication interface, and a transmitter;
  • the receiver is configured to receive a first connection request sent by the first client, where the first connection request includes a first address of the first client;
  • the processor is configured to search for a second client from the memory according to the first address of the first client received by the receiver, where the memory is used to store and be established with the server a first address and a second address of all the clients connected to the client, and the second client is a client belonging to the same local area network as the first client;
  • the processor is further configured to: if the second client is found, read the second address of the second client;
  • the sender is configured to return a first response message to the first client, where the first response message includes a second address of the second client, and the first response message is used to indicate the first
  • the client establishes a connection with the second client.
  • the memory is configured to store the first client in the memory if the processor does not find the second client The second address of the terminal establishes a connection with the first client.
  • the communication interface is configured to perform data with the first client by using the second client transmission.
  • the receiver is further configured to receive the first The third connection request sent by the client;
  • the processor is further configured to search a third client from the memory, where the third client is a client that belongs to the same local area network as the first client;
  • the processor is further configured to: if the third client is found, indicate the first client Establish a connection with the third client;
  • the communication interface is further configured to perform data transmission with the first client via the third client.
  • the receiver is further configured to receive the sending by the first client Fourth connection request;
  • the processor is further configured to: search, according to the fourth connection request received by the receiver, a fourth client from the memory, where the fourth client belongs to the same local area network as the first client Client
  • the processor is further configured to: if the fourth client is found, instruct the first client to establish a connection with the fourth client;
  • the communication interface is further configured to perform data transmission with the first client via the fourth client.
  • a seventh aspect provides a mobile terminal, where the mobile terminal includes: a transmitter, a receiver, a processor, and a communication interface;
  • the transmitter is configured to send a first connection request to the server, where the first connection request includes a first address of the mobile terminal;
  • the receiver is configured to receive a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is the same as the mobile terminal LAN client;
  • the processor is configured to establish a connection with the second client according to the first response message received by the receiver.
  • the receiver is further configured to receive a second response message sent by the server, where the second response message does not include the second client The second address of the end;
  • the processor is further configured to establish a connection with the server according to the second response message received by the receiver.
  • the communication interface is configured to perform data transmission with the server by using the second client.
  • the sender is further configured to send a third connection request to the server;
  • the receiver is further configured to receive a third response message sent by the server, where the third response message includes a second address of the third client, and the third client belongs to the same local area network as the mobile terminal Client
  • the processor is further configured to establish a connection with the third client according to the third response message received by the receiver;
  • the communication interface is further configured to perform data transmission with the server by using the third client.
  • the transmitter is further configured to send a fourth connection to the server request;
  • the receiver is further configured to receive a fourth response message sent by the server, where the fourth response message includes a second address of the fourth client, and the fourth client belongs to the same local area network as the mobile terminal Client
  • the processor is further configured to establish a connection with the fourth client according to the fourth response message received by the receiver;
  • the communication interface is further configured to perform data transmission with the server by using the fourth client.
  • the method for establishing a data connection, the server, and the mobile terminal provided by the embodiment of the present invention, when the server receives the connection request sent by the first client, determines whether the second client that belongs to the same local area network as the first client has been established. a connection, if yes, returning a response message indicating that the first client establishes a connection with the second client to the first client, and disconnecting the connection between the first client and the second client after the connection is established.
  • the connection of the first client thereby effectively reducing the number of long connections between devices, thereby achieving the goal of saving network resources.
  • Figure 1 is a schematic view of a push system
  • FIG. 2 is an information interaction diagram of a method for establishing a data connection according to Embodiment 1 of the present invention
  • FIG. 4 is a flowchart of a method for establishing a data connection according to Embodiment 2 of the present invention.
  • FIG. 5 is a flowchart of a method for establishing a data connection according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic diagram of a server provided according to Embodiment 4 of the present invention.
  • FIG. 7 is a schematic diagram of a mobile terminal according to Embodiment 5 of the present invention.
  • FIG. 8 is a schematic diagram of a server provided according to Embodiment 6 of the present invention.
  • FIG. 9 is a schematic diagram of a mobile terminal according to Embodiment 7 of the present invention.
  • the push system includes: a server and at least one client (also called a device), and the server is in the external network, and the server is uniquely connected.
  • the first address (also known as the external network address, including the IP address and the listening port) for client access, each client is in the local area network (also known as the intranet), it should be noted that each client can directly The network communicates with each other, and can also communicate with the server in the external network; when each client communicates with each other on the internal network, each client in each client can be assigned a corresponding second address (also called an intranet address, Including the IP address and port), and when any client communicates with the server in the external network, then any of the clients can be assigned a corresponding first address (including the IP address and port).
  • the local area network also known as the intranet
  • the network element of the firewall and the gateway function also called the gateway device
  • the client in the internal network needs to access the server in the external network
  • the gateway device can pass through a gateway device, and the gateway device can The first address and the second address are mapped, and the IP addresses of the first addresses of the clients in the same local area network after being mapped by the gateway device are the same, but the ports are different.
  • the server can determine whether the clients are the same according to whether the IP addresses of the first addresses of the clients are the same. No belongs to the same LAN.
  • each client in the same local area network can directly access each other using the IP address of the second address, so if one is in a local area network or Multiple clients have established a long connection with the server, and other clients can establish a connection with one or more of the above clients, thus reducing the number of long connections in the external network, and at the same time, in order to maintain these redundant Send a heartbeat message with a long connection.
  • the client 01 and the client 02 can establish a connection with the client 00, and do not need to establish a long connection directly with the server.
  • the client 00 sends a heartbeat message to maintain a long connection between the server and the server.
  • client 01 or client 02 and client 00 generally do not need to send a heartbeat message to maintain the connection in the same intranet.
  • Embodiment 2 is an information interaction diagram of a method for establishing a data connection according to Embodiment 1 of the present invention.
  • the method may specifically include:
  • the first client sends a first connection request to the server, where the first connection request includes the first address of the first client.
  • the first client may be any client in FIG. 1 , and when the first connection request is sent by the server in the outbound network, the protocol stack allocates a corresponding first address to the client, where The first address of a client may include the IP address and port of the first client.
  • the IP address of the first address of the first client is: 218.25.245.2.
  • the port of the first client is: a
  • the first connection request may include: 218.25.2245.2
  • the first connection request may further include port a.
  • the server searches for a second client from a preset storage unit according to the first address of the first client, where the preset storage unit is configured to store a connection with the server.
  • the first address and the second address of all the clients and all the clients, and the second client is a client belonging to the same local area network as the first client.
  • the preset storage unit is used for storing data, and may be a relational database or a file set by default.
  • the second client may belong to the same local area network as the first client, and the server side
  • the client in Figure 1 of the long connection has been established, which may correspond to the first address and the second address.
  • the first client is the client 01 in FIG. 1, and it is assumed that the client 00, the client n0 and the server have established a long connection, and the IP address of the first address of the client 00 is: 218.25.
  • the contents of the preset storage unit can be as shown in Table 1.
  • the client 00, the client n0 and the server have established a long connection
  • AA is a client (or device) belonging to the same local area network as the client 00
  • BB is a client belonging to the same local area network as the client n0. (or device).
  • the content of the foregoing table 1 is only one implementation of the preset storage unit.
  • the port of the first address may not be stored.
  • the port a and the port b may not be stored.
  • the process of searching for the second client from the preset storage unit according to the first address of the first client in S220 may be: sequentially reading the IP address of the first address of each client of the preset storage unit, And comparing the read IP address of the first address of each client with the IP address of the first address of the first client.
  • the server returns a first response message to the first client, where the first response message includes a second address of the second client.
  • the number of clients on the same LAN may reach thousands. Therefore, multiple clients may be selected from thousands of clients to establish a long connection with the server.
  • the server When the server is connected to the same LAN.
  • a plurality of clients establish a long connection if the first client in the local area network requests to establish a connection with the server, the server can find multiple second clients to be selected from Table 1.
  • a final second client may be selected from the plurality of second clients to be selected according to a preset algorithm.
  • the function of the preset algorithm may be to compare the stability of the plurality of second clients to be selected, and select the second client with the highest stability as the final second client, or may also be a calculation.
  • the resource consumption of the plurality of candidate second clients is selected, and the second client with the smallest resource consumption is selected as the final second client.
  • the server reads the second address of the client 00 from the table 1, and returns the first response message to the client 01.
  • the first response message includes: 192.168.0.0 and 2110, that is, the second address including the second client.
  • the first client establishes a connection with the second client according to the second address of the second client.
  • the first response message is used to indicate that the second client establishes a connection with the second client.
  • the client 01 after receiving the first response message, the client 01 sends a connection request to the client 00 according to the IP address of the second address of the client 00: 192.168.0.0 and the listening port: 2110, and the client 00 receives the connection according to After the connection request returns a response message to the client 01, the connection between the client 00 and the client 01 is established.
  • the method may further include the following steps:
  • the first client sends a message indicating that the connection establishment between the first client and the second client is completed to the server; the server records the correspondence between the first client and the second client in the preset storage unit; The server returns a first indication message to the first client; the first client disconnects from the server according to the first indication message.
  • the client 01 after establishing the connection with the client 00, the client 01 returns a message indicating that the connection establishment of the client 00 and the client 01 is completed, and the server may be in the table after receiving the message.
  • the correspondence between the client 00 and the client 01 is recorded, or the correspondence between the client 00 and the client 01 may be recorded in other preset storage units different from the table 1.
  • Table 1 the contents of the updated Table 1 can be as shown in Table 2.
  • the IP address and the listening port of the second address of the client 01 may also be recorded.
  • the server After the server records the corresponding relationship between the client 00 and the client 01 in the table 2, the server returns a first indication message to the client 01, where the first indication message is used to instruct the client 01 to disconnect from the server.
  • the server After establishing the connection relationship between the first client and the second client, the server performs data transmission with the first client via the second client.
  • the server sends the data message to the first client
  • the second client is obtained from the correspondence between the first client and the second client, and the second client is read from the preset storage unit.
  • the server when the server sends a message to the client 01, it first searches for a client from the column "Clients that have established a long connection with the server" in Table 1. End 01, if found, directly sends a message to the client 01 according to the first address of the client 01; if not found, the server does not establish a long connection with the server, at this time, if the client 01 and the client 00 The corresponding relationship is recorded in Table 1, and the client 00 corresponding to the client 01 is read from the table 1, otherwise the client 00 corresponding to the client 01 is read from other preset storage units; The IP address and port of the first address of the client 00 are read in Table 1.
  • the server After the server reads the first address of the client 00, it sends a first indication message to the client 00, where the first indication message may be the IP address of the second address of the client 01: 192.168.0.1 .
  • the client 00 After receiving the first indication message, the client 00 sends a first notification message to the client 01, where the first notification message is used to instruct the client 01 to send a second connection request to the server, and the server sends a second connection request to the client.
  • the connection between the server and the client 01 After returning the second response message, the connection between the server and the client 01 is established.
  • the server After the server establishes a connection with the client 01, the server sends a data message to the client 01, and after the data message is sent, the server returns a second message to the client 01.
  • the indication message is used to indicate that the client 01 disconnects from the server. Therefore, the number of long connections between the server and the client can be effectively reduced, thereby achieving the purpose of saving network resources.
  • the embodiment of the present invention may further include the following steps:
  • the server does not find the second client, storing the second address of the first client in the preset storage unit, and returning a second response message to the first client;
  • the first client establishes a connection with the server according to the received second response message.
  • the server records the first address and the second address of the client 01 in Table 1, and returns a second response message to the client 01 to establish the server and the client. 01 connection.
  • the client 01 sends a heartbeat message to the server, and the heartbeat message is used to maintain the connection between the server and the client 01.
  • FIG. 4 is a flowchart of a method for establishing a data connection according to Embodiment 2 of the present invention.
  • the executor of the method may be the server in FIG. 1 , as shown in FIG. 4 , the method may specifically include:
  • the server receives a first connection request sent by the first client, where the first connection request includes a first address of the first client.
  • the first client may be any client in FIG. 1 , and when the first connection request is sent by the server in the outbound network, the protocol stack allocates a corresponding first address to the client, where The first address of a client may include the IP address and port of the first client.
  • the IP address of the first address of the first client is: 218.25.245.2.
  • the first The port of the client is: a
  • the first connection request may include: 218.25.2245.2
  • the first connection request may further include port a.
  • S420 Search for a second client from a preset storage unit according to the first address of the first client, where the preset storage unit is configured to store all clients that have established a connection with the server. And a first address and a second address of all the clients, where the second client is a client belonging to the same local area network as the first client.
  • the preset storage unit is used for storing data, and may be a relational database or a file set by default.
  • the second client may be the client in FIG. 1 that belongs to the same local area network as the first client and has established a long connection with the server, and may correspond to the first address and the second address.
  • the first client is the client 01 in FIG. 1, and it is assumed that the client 00, the client n0 and the server have established a long connection, and the IP address of the first address of the client 00 is: 218.25.
  • the contents of the preset storage unit can be as shown in Table 1.
  • the process of searching for the second client from the preset storage unit according to the first address of the first client in the S420 may be: sequentially reading the IP address of the first address of each client of the preset storage unit, And comparing the read IP address of the first address of each client with the IP address of the first address of the first client.
  • the number of clients on the same local area network may reach thousands. Therefore, multiple clients may be selected from thousands of clients to establish a long connection with the server.
  • the server can find multiple second clients to be selected from Table 1.
  • a final second client may be selected from the plurality of second clients to be selected according to a preset algorithm.
  • the function of the preset algorithm may be to compare the stability of the plurality of second clients to be selected, and select the second client with the highest stability as the final second client, or may also be a calculation.
  • the resource consumption of the plurality of candidate second clients is selected, and the second client with the smallest resource consumption is selected as the final second client.
  • the server reads the second address of the client 00 from the table 1, and returns the first response message to the client 01.
  • the first response message includes: 192.168.0.0 and 2110, that is, the second address including the second client.
  • the client 01 sends a connection request to the client 00 according to the IP address of the second address of the client 00: 192.168.0.0 and the listening port: 2110, and the client 00 sends a connection request according to the received connection request.
  • the client 01 returns a response message, the connection between the client 00 and the client 01 is established.
  • the method may further include the following steps:
  • the first client sends a message indicating that the connection establishment between the first client and the second client is completed to the server; the server records the correspondence between the first client and the second client in the preset storage unit; The server returns a first indication message to the first client; the first client disconnects from the server according to the first indication message.
  • the server can perform data transmission with the first client via the second client, and the specific transmission process is as described in the first embodiment of the present invention. This will not be repeated.
  • the embodiment of the present invention may further include the following steps:
  • the server performs data transmission with the first client via the third client.
  • the client 01 when the client 00 leaves the local area network to which the client 01 belongs (for example, leaving the wifi hotspot range, or switching from the wifi network to the cellular network, or the client i0 is turned off), the client 01 is at the preset time. The message sent by the client 00 is not received in the range, and the client 01 determines to disconnect from the client 00. At this time, the server receives the third connection request sent by the client 01, and the server receives the message.
  • the server receives the third connection request sent by the client 01, and the server receives the message.
  • the third client is searched from the preset storage unit, where the third client and the client 01 belong to the same local area network, and the third client establishes a connection with the server, and if found, Then, the second address of the third client is returned to the client 01, so that the client 01 establishes a connection with the third client according to the second address of the third client.
  • process of establishing a connection between the third client and the first client may be referred to the process of establishing a connection between the second client and the first client in step S430, and details are not described herein.
  • the server After establishing the connection relationship between the first client and the third client, the server performs data transmission with the first client via the third client, and the specific transmission process is as shown in Embodiment 1 of the present invention. As described, it will not be described here.
  • the third response message does not include the second address of the third client; the first client establishes a connection with the server according to the third response message.
  • the method may further include the following steps:
  • the server performs data transmission with the first client via the fourth client.
  • the server determines that it is disconnected from the client 00; or when the server receives the message received from the client 00.
  • the message determines that the connection address of the client 00 changes.
  • the server receives the fourth connection request sent by the client 01, according to the first address of the client 01 carried in the fourth connection request, from the preset Looking up the fourth client in the storage unit, where the fourth client and the client 01 belong to the same local area network, and the fourth client establishes a connection with the server, and if found, returns the fourth client to the client 01.
  • the second address is such that the client 01 establishes a connection with the fourth client according to the second address of the fourth client.
  • process of establishing a connection between the fourth client and the first client may be referred to the process of establishing a connection between the second client and the first client in step S430, and details are not described herein.
  • the server After establishing the connection relationship between the first client and the fourth client, the server performs data transmission with the first client via the fourth client, and the specific transmission process is as shown in Embodiment 1 of the present invention. As described, it will not be described here.
  • the fourth response message is returned, and the fourth response message does not include the second address of the fourth client; the first client establishes a connection with the server according to the fourth response message.
  • the first connection request in step S410 may further include a second address of the first client.
  • the foregoing embodiment describes the case where the second client is found in the preset storage unit.
  • the embodiment of the present invention may further include the following steps:
  • the second address of the first client is stored in the preset storage unit, and a connection with the first client is established.
  • IP address of the first address of each client in the preset storage unit is the same as the number of the first client
  • the IP address of an address is inconsistent; or the plurality of second clients to be selected are full load, that is, according to a preset algorithm, the second client cannot be selected. In the final second client, it is considered that the second client is not found.
  • the server records the first address and the second address of the client 01 in Table 1, and returns a second response message to the client 01 to establish the server and the client. 01 connection.
  • the client 01 sends a heartbeat message to the server, and the heartbeat message is used to maintain the connection between the server and the client 01.
  • the method for establishing a data connection provided by the embodiment of the present invention, when receiving the connection request sent by the first client, the server determines whether the connection with the second client belonging to the same local area of the first client has been established, and if so, Returning, to the first client, a response message for indicating that the first client establishes a connection with the second client, and disconnecting the first client after the connection establishment of the first client and the second client is completed, Therefore, the number of long connections between devices can be effectively reduced, thereby achieving the purpose of saving network resources.
  • FIG. 5 is a schematic diagram of a method for establishing a data connection according to Embodiment 3 of the present invention.
  • the method for performing the method may be the client in FIG. 1 .
  • the method may specifically include:
  • the first client sends a first connection request to the server, where the first connection request includes the first address of the first client.
  • the first client may be any client in FIG. 1 , and when the first connection request is sent by the server in the outbound network, the protocol stack allocates a corresponding first address to the client, where The first address of a client may include the IP address and port of the first client.
  • the IP address of the first address of the first client is: 218.25.245.2.
  • the port of the first client is: a
  • the first connection request may include: 218.25.2245.2
  • the first connection request may further include port a.
  • the server searches for the second client from the preset storage unit according to the first address of the first client.
  • the preset storage unit is used for storing data, and may be a relational database or a file set by default.
  • the first The second client may be a client in FIG. 1 that belongs to the same local area network as the first client and has established a long connection with the server, and may correspond to the first address and the second address.
  • the first client is the client 01 in FIG. 1, and it is assumed that the client 00, the client n0 and the server have established a long connection, and the IP address of the first address of the client 00 is: 218.25.
  • the contents of the preset storage unit can be as shown in Table 1.
  • Table 1 the client 00, the client n0 and the server have established a long connection, and AA is a client (or device) belonging to the same local area network as the client 00, and BB is a client belonging to the same local area network as the client n0. (or device).
  • the port of the first address may not be stored.
  • the port a and the port b may not be stored.
  • the process of searching for the second client from the preset storage unit according to the first address of the first client may be: sequentially reading the IP address of the first address of each client of the preset storage unit, and The IP address of the first address of each client read is compared with the IP address of the first address of the first client.
  • S520 Receive a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is a client that belongs to the same local area network as the first client. end.
  • the number of clients on the same LAN may reach thousands. Therefore, multiple clients may be selected from thousands of clients to establish a long connection with the server.
  • the server When the server is connected to the same LAN.
  • the server can find multiple second clients to be selected from Table 1.
  • a final second client may be selected from the plurality of second clients to be selected according to a preset algorithm.
  • the role of the preset algorithm can Comparing the stability of the plurality of second clients to be selected, selecting the second client with the highest stability as the final second client, or calculating the resources of the plurality of second clients to be selected. Consumption, the second client that minimizes resource consumption is selected as the final second client.
  • the server reads the second address of the client 00 from the table 1, and returns the first response message to the client 01.
  • the first response message includes: 192.168.0.0 and 2110, that is, the second address including the second client.
  • the first response message is used to indicate that the first client establishes a connection with the second client.
  • the client 01 After receiving the first response message, the client 01 sends a connection request to the client 00 according to the IP address of the second address of the client 00: 192.168.0.0 and the listening port: 2110, and the client 00 sends a connection request according to the received connection request. After the client 01 returns a response message, the connection between the client 00 and the client 01 is established.
  • the method may further include the following steps:
  • the first client sends a message indicating that the connection establishment between the first client and the second client is completed to the server; the server records the correspondence between the first client and the second client in the preset storage unit; The server returns a first indication message to the first client; the first client disconnects from the server according to the first indication message.
  • the server can perform data transmission with the first client via the second client, and the specific transmission process is as described in the first embodiment of the present invention. This will not be repeated.
  • the embodiment of the present invention may further include the following steps:
  • the server Receiving a third response message sent by the server, where the third response message includes a third client a second address of the terminal, where the third client is a client that belongs to the same local area network as the first client;
  • the first client performs data transmission with the server via the third client.
  • the client 01 when the client 00 leaves the local area network to which the client 01 belongs (for example, leaving the wifi hotspot range, or switching from the wifi network to the cellular network, or the client i0 is turned off), the client 01 is at the preset time. The message sent by the client 00 is not received in the range, and the client 01 determines to disconnect from the client 00. At this time, the server receives the third connection request sent by the client 01, and the server receives the message.
  • the server receives the third connection request sent by the client 01, and the server receives the message.
  • the third client is searched from the preset storage unit, where the third client and the client 01 belong to the same local area network, and the third client establishes a connection with the server, and if found, Then, the second address of the third client is returned to the client 01, so that the client 01 establishes a connection with the third client according to the second address of the third client.
  • process of establishing a connection between the third client and the first client may be referred to the process of establishing a connection between the second client and the first client in step S530, and details are not described herein.
  • the server After establishing the connection relationship between the first client and the third client, the server performs data transmission with the first client via the third client, and the specific transmission process is as shown in Embodiment 1 of the present invention. As described, it will not be described here.
  • the third response message does not include the second address of the third client; the first client establishes a connection with the server according to the third response message.
  • the method may further include the following steps:
  • the first client performs data transmission with the server via the fourth client.
  • the server determines that it is disconnected from the client 00; or when the server receives the message received from the client 00.
  • the message determines that the connection address of the client 00 changes.
  • the server receives the fourth connection request sent by the client 01, according to the first address of the client 01 carried in the fourth connection request, from the preset Looking up the fourth client in the storage unit, where the fourth client and the client 01 belong to the same local area network, and the fourth client establishes a connection with the server, and if found, returns the fourth client to the client 01.
  • the second address is such that the client 01 establishes a connection with the fourth client according to the second address of the fourth client.
  • process of establishing a connection between the fourth client and the first client may be referred to the process of establishing a connection between the second client and the first client in step S530, and details are not described herein.
  • the server After establishing the connection relationship between the first client and the fourth client, the server performs data transmission with the first client via the fourth client, and the specific transmission process is as shown in Embodiment 1 of the present invention. As described, it will not be described here.
  • the fourth response message is returned, and the fourth response message does not include the second address of the fourth client; the first client establishes a connection with the server according to the fourth response message.
  • the first connection request in step S510 may further include a second address of the first client.
  • the second response message includes the second address of the second client, and when the second response message does not include the second address of the second client, the embodiment of the present invention may further include The following steps:
  • the server returns to the first client.
  • the second address of the second client is not included in the second response message.
  • the server records the first address and the second address of the client 01 in Table 1, and returns a second response message to the client 01 to establish the server and the client. 01 connection.
  • the client 01 sends a heartbeat message to the server, and the heartbeat message is used to maintain the connection between the server and the client 01.
  • the method for establishing a data connection provided by the embodiment of the present invention, when receiving the connection request sent by the first client, the server determines whether the connection with the second client belonging to the same local area of the first client has been established, and if so, Returning, to the first client, a response message for indicating that the first client establishes a connection with the second client, and disconnecting the first client after the connection establishment of the first client and the second client is completed, Therefore, the number of long connections between devices can be effectively reduced, thereby achieving the purpose of saving network resources.
  • FIG. 6 is a schematic diagram of a server provided according to Embodiment 4 of the present invention.
  • the server can be used to perform the method described in FIG.
  • the server includes: a receiving unit 601, a searching unit 602, and a reading unit 603.
  • the receiving unit 601 is configured to receive a first connection request sent by the first client, where the first connection request includes a first address of the first client.
  • the searching unit 602 is configured to search for a second client from the preset storage unit according to the first address of the first client received by the receiving unit 601, where the preset storage unit is configured to store
  • the server has established all the clients of the connection and the first address and the second address of all the clients, and the second client is a client belonging to the same local area network as the first client.
  • the reading unit 603 is configured to: if the searching unit 602 finds the second client, read the location The second address of the second client.
  • the sending unit 604 is configured to return a first response message to the first client, where the first response message includes a second address of the second client, and the first response message is used to indicate the first client
  • the terminal establishes a connection with the second client.
  • the server further includes: a saving unit 605;
  • the saving unit 605 is configured to: if the searching unit 602 does not find the second client, store the second address of the first client in the preset storage unit, and establish a connection with the first client. .
  • the server further includes: a first transmission unit 606;
  • the first transmission unit 606 is configured to perform data transmission with the first client via the second client.
  • the server further includes: a first indication unit 607 and a second transmission unit 608;
  • the receiving unit 601 is further configured to receive a third connection request sent by the first client.
  • the searching unit 602 is further configured to: search for a third client from the preset storage unit, where the third client is a client that belongs to the same local area network as the first client;
  • the first indication unit 607 is configured to: if the searching unit 602 finds the third client, instruct the first client to establish a connection with the third client;
  • the second transmission unit 608 is further configured to perform data transmission with the first client via the third client.
  • the server further includes: a second indication unit 609 and a third transmission unit 610;
  • the receiving unit 601 is further configured to receive a fourth connection request sent by the first client.
  • the searching unit 602 is further configured to: search, according to the fourth connection request received by the receiving unit 601, a fourth client from the preset storage unit, where the fourth client belongs to the first client Clients on the same LAN;
  • the second instructing unit 609 is configured to: if the searching unit 602 finds the fourth client, instructing the first client to establish a connection with the fourth client;
  • the third transmission unit 610 is configured to perform data transmission with the first client via the fourth client.
  • the server When receiving the connection request sent by the first client, the server provided by the embodiment of the present invention determines whether a connection has been established with the second client that belongs to the same local area network as the first client, and if yes, to the first client. Returning a response message for indicating that the first client establishes a connection with the second client, and disconnecting the connection with the first client after the connection establishment of the first client and the second client is completed, thereby being effective Reduce the number of long connections between devices, so as to save network resources.
  • FIG. 7 is a schematic diagram of a mobile terminal according to Embodiment 5 of the present invention.
  • the mobile terminal can be used to perform the method described in FIG.
  • the mobile terminal includes: a transmitting unit 701, a receiving unit 702, and an establishing unit 703.
  • the sending unit 701 is configured to send a first connection request to the server, where the first connection request includes the first address of the mobile terminal.
  • the receiving unit 702 is configured to receive a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is in the same local area network as the mobile terminal Client.
  • the establishing unit 703 is configured to establish a connection with the second client according to the first response message received by the receiving unit 702.
  • the receiving unit 702 is further configured to receive a second response message sent by the server, where the second response message does not include the second address of the second client;
  • the establishing unit 703 is further configured to establish a connection with the server according to the second response message received by the receiving unit 702.
  • the mobile terminal further includes: a first transmission unit 704;
  • a first transmission unit 704 configured to perform data transmission with the server by using the second client lose.
  • the mobile terminal further includes: a second transmission unit 705;
  • the sending unit 701 is further configured to send a third connection request to the server.
  • the receiving unit 702 is further configured to receive a third response message sent by the server, where the third response message includes a second address of the third client, where the third client belongs to the same local area network as the mobile terminal.
  • the establishing unit 703 is further configured to establish a connection with the third client according to the third response message received by the receiving unit 702.
  • the second transmission unit 705 is configured to perform data transmission with the server by using the third client.
  • the mobile terminal further includes: a third transmission unit 706;
  • the sending unit 701 is further configured to send a fourth connection request to the server.
  • the receiving unit 702 is further configured to receive a fourth response message sent by the server, where the fourth response message includes a second address of the fourth client, where the fourth client belongs to the same local area network as the mobile terminal Client
  • the establishing unit 703 is further configured to establish a connection with the fourth client according to the fourth response message received by the receiving unit 702.
  • the third transmission unit 706 is configured to perform data transmission with the server by using the fourth client.
  • the mobile terminal When receiving the connection request sent by the first client, the mobile terminal provided by the embodiment of the present invention determines whether a connection has been established with the second client that belongs to the same local area network as the first client, and if yes, to the first client. Returning a response message for indicating that the first client establishes a connection with the second client, and disconnecting the first client after the connection establishment of the first client and the second client is completed, thereby effectively reducing the connection
  • the number of long connections between devices can save network resources The purpose of the source.
  • FIG. 8 is a schematic diagram of a server provided according to Embodiment 6 of the present invention.
  • the server includes: a receiver 801, a processor 802, a memory 803, a communication interface 804, a transmitter 805, and a bus 806, wherein the receiver 801, the processor 802, the memory 803, and the communication interface 804 The transmitter 805 communicates with the bus 806.
  • processor 802 can be a CPU.
  • Communication interface 804 is used to communicate with other devices.
  • the memory 803 may be a persistent storage such as a hard disk drive and a flash memory having a software module and a device driver therein.
  • the software modules are capable of performing the various functional modules of the above described methods of the present invention; the device drivers can be network and interface drivers.
  • the receiver 801 is configured to receive a first connection request sent by the first client, where the first connection request includes a first address of the first client.
  • the processor 802 is configured to search, from the memory, the second client according to the first address of the first client received by the receiver 801, where the memory is used to store a connection established with the server. a first address and a second address of all clients and all clients, the second client being a client belonging to the same local area network as the first client;
  • the processor 802 is further configured to: if the second client is found, read the second address of the second client;
  • a sender 805 configured to return a first response message to the first client, where the first response message includes a second address of the second client, and the first response message is used to indicate the first client
  • the terminal establishes a connection with the second client.
  • the memory 803 is configured to: if the processor does not find the second client, store a second address of the first client in the memory, and establish a connection with the first client. .
  • the communication interface 804 is configured to perform data transmission with the first client via the second client.
  • the receiver 801 is further configured to receive a third connection request sent by the first client.
  • the processor 802 is further configured to search, from the memory 803, a third client, where the third client is a client that belongs to the same local area network as the first client;
  • the processor 802 is further configured to: if the third client is found, instruct the first client to establish a connection with the third client;
  • the communication interface 804 is further configured to perform data transmission with the first client via the third client.
  • the receiver 801 is further configured to receive a fourth connection request sent by the first client.
  • the processor 802 is further configured to: search, according to the fourth connection request received by the receiver 801, the fourth client from the memory, where the fourth client is a client that belongs to the same local area network as the first client. end;
  • the processor 802 is further configured to: if the fourth client is found, instruct the first client to establish a connection with the fourth client;
  • the communication interface 804 is further configured to perform data transmission with the first client via the fourth client.
  • the server provided by the embodiment of the invention can effectively reduce the number of long connections between devices, thereby achieving the purpose of saving network resources.
  • FIG. 9 is a schematic diagram of a mobile terminal according to Embodiment 7 of the present invention.
  • the mobile terminal includes: a transmitter 901, a receiver 902, a processor 903, a communication interface 904, and a bus 905, wherein the transmitter 901, the receiver 902, the processor 903, and the communication interface 904 pass through a bus. 905 communication.
  • the processor 903 can be a CPU.
  • Communication interface 904 is used to communicate with other devices.
  • the mobile terminal can also include a memory 906 that is also coupled to the processor 903 via a system bus 905.
  • Memory 906 can be a persistent storage, such as a hard drive and flash memory, with software modules and device drivers in memory 906.
  • Software module capable of performing the above described invention Various functional modules of the method; device drivers can be network and interface drivers.
  • the sender 901 is configured to send a first connection request to the server, where the first connection request includes the first address of the mobile terminal.
  • the receiver 902 is configured to receive a first response message sent by the server, where the first response message includes a second address of the second client, and the second client is in the same local area network as the mobile terminal Client.
  • the processor 903 is configured to establish a connection with the second client according to the first response message received by the receiver 902.
  • the receiver 902 is further configured to receive a second response message sent by the server, where the second response message does not include the second address of the second client;
  • the processor 903 is further configured to establish a connection with the server according to the second response message received by the receiver 902.
  • the communication interface 904 is configured to perform data transmission with the server by using the second client.
  • the sender 901 is further configured to send a third connection request to the server.
  • the receiver 902 is further configured to receive a third response message sent by the server, where the third response message includes a second address of the third client, where the third client belongs to the same local area network as the mobile terminal.
  • the processor 903 is further configured to establish a connection with the third client according to the third response message received by the receiver 902.
  • the communication interface 904 is further configured to perform data transmission with the server by using the third client.
  • the sender 901 is further configured to send a fourth connection request to the server.
  • the receiver 902 is further configured to receive a fourth response message sent by the server, where the fourth response message includes a second address of the fourth client, where the fourth client belongs to the same local area network as the mobile terminal.
  • Processing 903, further configured to establish and cooperate according to the fourth response message received by the receiver 902 The connection of the fourth client;
  • the communication interface 904 is further configured to perform data transmission with the server by using the fourth client.
  • the mobile terminal provided by the embodiment of the invention can effectively reduce the number of long connections between devices, thereby achieving the purpose of saving network resources.
  • the steps of a method or algorithm described in connection with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本发明实施例涉及一种数据连接的建立方法、服务端及移动终端,服务端在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后,断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。

Description

数据连接的建立方法、服务端及移动终端 技术领域
本发明涉及移动通信领域,尤其涉及一种数据连接的建立方法、服务端及移动终端。
背景技术
在广域网络中,有些网元会跟踪设备间的连接,如果连接上超过阈值时间没有消息,连接就会被断开。然而,有些设备间通常需要及时的发送消息(也即设备间需要保持长连接),且该发送的消息可能是超过阈值时间的,如,推送***的服务端向推送***的客户端发送的消息,上述断开连接的方式,会导致服务端不能及时地向客户端下发消息,这会影响推送***的性能。
现有技术中,为了保持长连接,设备(如,服务端和客户端)间通常需要发送心跳消息,该心跳消息是指周期性的在两个设备间发送的数据包,而在大多数时间段,服务端和客户端间是没有有用的消息交互的,这样就造成了网络流量资源、连接数资源和服务端资源的浪费。
发明内容
本发明实施例提供了一种数据连接的建立方法、服务端及移动终端,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
第一方面,提供了一种数据连接的建立方法,该方法包括:
第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
所述服务端根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
若所述服务端查找到所述第二客户端,则读取所述第二客户端的第二地址,向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;
所述第一客户端根据所述第二客户端的第二地址,建立与所述第二客户 端的连接。
结合第一方面,在第一方面的第一种实现方式中,所述第一连接请求还包含第一客户端的第二地址,所述方法还包括:
若所述服务端未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,并向所述第一客户端返回第二应答消息;
所述第一客户端根据接收的所述第二应答消息,建立与所述服务端的连接。
结合第一方面或第一方面的第一种实现方式,在第一方面的第二种实现方式中,在所述建立与所述第一客户端的连接之后,所述方法还包括:
所述服务端经由所述第二客户端与所述第一客户端进行数据传输。
第二方面,提供了一种数据连接的建立方法,该方法包括:
服务端接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
若查找到所述第二客户端,则读取所述第二客户端的第二地址,向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;
所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
结合第二方面,在第二方面的第一种实现方式中,所述第一连接请求还包含第一客户端的第二地址,所述方法还包括:
若未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
结合第二方面或第二方面的第一种实现方式,在第二方面的第二种实现方式中,所述方法还包括:
所述服务端经由所述第二客户端与所述第一客户端进行数据传输。
结合第二方面或第二方面的第一种实现方式或第二方面的第二种实现方式,在第二方面的第三种实现方式中,当所述第一客户端与所述第二客户 端断开连接时,所述方法还包括:
接收所述第一客户端发送的第三连接请求;
从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
若查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
所述服务端经由所述第三客户端与所述第一客户端进行数据传输。
结合第二方面或第二方面的上述三种实现方式中任一种实现方式,在第二方面的第四种实现方式中,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还包括:
接收所述第一客户端发送的第四连接请求;
根据所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
所述服务端经由所述第四客户端与所述第一客户端进行数据传输。
第三方面,提供了一种数据连接的建立方法,该方法包括:
第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
根据所述第一应答消息,建立与所述第二客户端的连接。
结合第三方面,在第三方面的第一种实现方式中,所述方法还包括:
接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
根据所述第二应答消息,建立与所述服务端的连接。
结合第三方面或第三方面的第一种实现方式,在第三方面的第二种实现方式中,所述方法还包括:
所述第一客户端经由所述第二客户端与所述服务端进行数据传输。
结合第三方面或第三方面的第一种实现方式或第三方面的第二种实现 方式,在第三方面的第三种实现方式中,当所述第一客户端与所述第二客户端断开连接时,所述方法还包括:
向所述服务端发送第三连接请求;
接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
根据所述第三应答消息,建立与所述第三客户端的连接;
所述第一客户端经由所述第三客户端与所述服务端进行数据传输。
结合第三方面或第三方面的上述三种实现方式中任一种实现方式,在第三方面的第四种实现方式中,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还包括:
向所述服务端发送第四连接请求;
接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
根据所述第四应答消息,建立与所述第四客户端的连接;
所述第一客户端经由所述第四客户端与所述服务端进行数据传输。
第四方面,提供了一种服务端,该服务端包括:接收单元、查找单元和读取单元;
所述接收单元,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
所述查找单元,用于根据所述接收单元接收的所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
所述读取单元,用于若所述查找单元查找到所述第二客户端,则读取所述第二客户端的第二地址;
所述发送单元,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
结合第四方面,在第四方面的第一种实现方式中,所述服务端还包括: 保存单元;
所述保存单元,用于若所述查找单元未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
结合第四方面或第四方面的第一种实现方式,在第四方面的第二种实现方式中,所述服务端还包括:第一传输单元;
所述第一传输单元,用于经由所述第二客户端与所述第一客户端进行数据传输。
结合第四方面或第四方面的第一种实现方式或第四方面的第二种实现方式,在第四方面的第三种实现方式中,所述服务端还包括:第一指示单元和第二传输单元;
所述接收单元,还用于接收所述第一客户端发送的第三连接请求;
所述查找单元,还用于从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
所述第一指示单元,用于若所述查找单元查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
所述第二传输单元,还用于经由所述第三客户端与所述第一客户端进行数据传输。
结合第四方面或第四方面的上述三种实现方式中任一种实现方式,在第四方面的第四种实现方式中,所述服务端还包括:第二指示单元和第三传输单元;
所述接收单元,还用于接收所述第一客户端发送的第四连接请求;
所述查找单元,还用于根据所述接收单元接收的所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
所述第二指示单元,用于若所述查找单元查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
所述第三传输单元,用于经由所述第四客户端与所述第一客户端进行数据传输。
第五方面,提供了一种移动终端,该移动终端包括:发送单元、接收单元和建立单元;
所述发送单元,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址;
所述接收单元,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属于同一局域网的客户端;
所述建立单元,用于根据所述接收单元接收的所述第一应答消息,建立与所述第二客户端的连接。
结合第五方面,在第五方面的第一种实现方式中,所述接收单元,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
所述建立单元,还用于根据所述接收单元接收的所述第二应答消息,建立与所述服务端的连接。
结合第五方面或第五方面的第一种实现方式,在第五方面的第二种实现方式中,所述移动终端还包括:第一传输单元;
所述第一传输单元,用于经由所述第二客户端与所述服务端进行数据传输。
结合第五方面或第五方面的第一种实现方式或第五方面的第二种实现方式,在第五方面的第三种实现方式中,所述移动终端还包括:第二传输单元;
所述发送单元,还用于向所述服务端发送第三连接请求;
所述接收单元,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
所述建立单元,还用于根据所述接收单元接收的所述第三应答消息,建立与所述第三客户端的连接;
所述第二传输单元,用于经由所述第三客户端与所述服务端进行数据传输。
结合第五方面或第五方面的上述三种实现方式中任一种实现方式,在第五方面的第四种实现方式中,所述移动终端还包括:第三传输单元;
所述发送单元,还用于向所述服务端发送第四连接请求;
所述接收单元,还用于接收所述服务端发送的第四应答消息,所述第四 应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
所述建立单元,还用于根据所述接收单元接收的所述第四应答消息,建立与所述第四客户端的连接;
所述第三传输单元,用于经由所述第四客户端与所述服务端进行数据传输。
第六方面,提供了一种服务端,该服务端包括:接收器、处理器、存储器、通信接口和发送器;
所述接收器,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
所述处理器,用于根据所述接收器接收的所述第一客户端的第一地址,从所述存储器中查找第二客户端,其中,所述存储器用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
所述处理器,还用于若查找到所述第二客户端,则读取所述第二客户端的第二地址;
所述发送器,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
结合第六方面,在第六方面的第一种实现方式中,所述存储器,用于若所述处理器未查找到所述第二客户端,则在所述存储器中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
结合第六方面或第六方面的第一种实现方式,在第六方面的第二种实现方式中,所述通信接口,用于经由所述第二客户端与所述第一客户端进行数据传输。
结合第六方面或第六方面的第一种实现方式或第六方面的第二种实现方式,在第六方面的第三种实现方式中,所述接收器,还用于接收所述第一客户端发送的第三连接请求;
所述处理器,还用于从所述存储器中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
所述处理器,还用于若查找到所述第三客户端,则指示所述第一客户端 建立与第三客户端的连接;
所述通信接口,还用于经由所述第三客户端与所述第一客户端进行数据传输。
结合第六方面或第六方面的上述三种实现方式中任一种实现方式,在第六方面的第四种实现方式中,所述接收器,还用于接收所述第一客户端发送的第四连接请求;
所述处理器,还用于根据所述接收器接收的所述第四连接请求,从所述存储器中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
所述处理器,还用于若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
所述通信接口,还用于经由所述第四客户端与所述第一客户端进行数据传输。
第七方面,提供了一种移动终端,该移动终端包括:发送器、接收器、处理器和通信接口;
所述发送器,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址;
所述接收器,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属于同一局域网的客户端;
所述处理器,用于根据所述接收器接收的所述第一应答消息,建立与所述第二客户端的连接。
结合第七方面,在第七方面的第一种实现方式中,所述接收器,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
所述处理器,还用于根据所述接收器接收的所述第二应答消息,建立与所述服务端的连接。
结合第七方面或第七方面的第一种实现方式,在第七方面的第二种实现方式中,所述通信接口,用于经由所述第二客户端与所述服务端进行数据传输。
结合第七方面或第七方面的第一种实现方式或第七方面的第二种实现 方式,在第七方面的第三种实现方式中,所述发送器,还用于向所述服务端发送第三连接请求;
所述接收器,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
所述处理器,还用于根据所述接收器接收的所述第三应答消息,建立与所述第三客户端的连接;
所述通信接口,还用于经由所述第三客户端与所述服务端进行数据传输。
结合第七方面或第七方面的上述三种实现方式中任一种实现方式,在第七方面的第四种实现方式中,所述发送器,还用于向所述服务端发送第四连接请求;
所述接收器,还用于接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
所述处理器,还用于根据所述接收器接收的所述第四应答消息,建立与所述第四客户端的连接;
所述通信接口,还用于经由所述第四客户端与所述服务端进行数据传输。
本发明实施例提供的数据连接的建立方法、服务端及移动终端,服务端在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后,断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
附图说明
图1为推送***的示意图;
图2为本发明实施例一提供的数据连接的建立方法信息交互图;
图3为本发明提供的信息交互图;
图4为本发明实施例二提供的数据连接的建立方法流程图;
图5为本发明实施例三提供的数据连接的建立方法流程图;
图6为本发明实施例四提供的服务端示意图;
图7为本发明实施例五提供的移动终端示意图;
图8为本发明实施例六提供的服务端示意图;
图9为本发明实施例七提供的移动终端示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
为便于对本发明实施例的理解,下面将结合附图以具体实施例做进一步的解释说明,实施例并不构成对本发明实施例的限定。
本发明提供的数据连接的建立方法应用于图1所示的推送***,图1中,推送***包括:服务端和至少一个客户端(也称设备),服务端在外网中,服务端对应唯一的第一地址(也称外网地址,包括IP地址和监听端口),供客户端访问,各客户端都在局域网(也称内网)中,需要说明的是,各客户端可以直接在内网相互通信,也可以与外网中的服务端通信;当各客户端在内网相互通信时,各客户端中的每个客户端可以被分配相应的第二地址(也称内网地址,包括IP地址和端口),而当任一客户端与外网中的服务端通信时,则该任一客户端可以被分配相应的第一地址(包括IP地址和端口)。此外,在内网和外网间是防火墙及网关功能的网元(也称网关设备),在内网中的客户端要访问外网中的服务端,都会经过一个网关设备,这个网关设备能够映射第一地址和第二地址,经过这个网关设备映射后的同一局域网中的各客户端的第一地址的IP地址都是一样的,只是端口不同。这样服务端就可以根据各客户端的第一地址的IP地址是否相同,判断出上述各客户端是 否属于同一局域网中。
图1中,在同一局域网中的各客户端(如,客户端00、客户端01以及客户端02)是可以直接使用第二地址的IP地址进行相互访问的,所以如果在一个局域网中一个或多个客户端已经和服务端建立了长连接,其它客户端就可以和上述一个或多个客户端建立连接,这样就减少了外网中的长连接个数,同时也不用为了维持这些多余的长连接而发送心跳消息。举例来说,客户端00和服务端建立了长连接后,则客户端01、客户端02可以和客户端00建立连接,不需要直接和服务端建立长连接。其中客户端00发送心跳消息维持和服务端间的长连接。通常情况下,客户端01或者客户端02和客户端00在同一个内网中一般不需要发送心跳消息维持连接。
图2为本发明实施例一提供的数据连接的建立方法信息交互图。所述方法具体可以包括:
S210,第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址。
在此说明,第一客户端可以为图1中的任一客户端,其在向外网中的服务端发送第一连接请求时,协议栈会为其分配相应的第一地址,其中,第一客户端的第一地址可以包括第一客户端的IP地址和端口。
举例来说,第一客户端的第一地址的IP地址为:218.25.245.2。第一客户端的端口为:a,则上述第一连接请求可以包含:218.25.245.2,此外,第一连接请求还可以包含端口a。
S220,所述服务端根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端。
此处,预设的存储单元用于存储数据,可以为预设设置的关系数据库或者文件等。而第二客户端可以为与第一客户端属于同一局域网,且与服务端 已建立长连接的图1中的客户端,其可以对应第一地址和第二地址。举例来说,第一客户端为图1中的客户端01,且假设客户端00、客户端n0与服务端已建立了长连接,在客户端00的第一地址的IP地址为:218.25.245.2,且客户端00的第二地址的IP地址为:192.168.0.0,客户端n0的第一地址的IP地址为:218.25.245.3,且客户端n0的第二地址的IP地址为:192.168.1.0的情况下,预设的存储单元的内容可以如表1所示。
表1
Figure PCTCN2016095681-appb-000001
表1中,客户端00、客户端n0与服务端已建立了长连接,而AA为与客户端00属于同一局域网的客户端(或者设备),BB为与客户端n0属于同一局域网的客户端(或者设备)。当然,上述表1的内容只是预设的存储单元的一种实现方式,在其它实现方式中,也可以不存储第一地址的端口,如,可以不存储端口a和端口b。
而S220中根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端的过程具体可以为:依次读取预设的存储单元的各客户端的第一地址的IP地址,并将读取的各客户端的第一地址的IP地址与第一客户端的第一地址的IP地址进行比对。
S230,若所述服务端查找到所述第二客户端,则读取所述第二客户端的 第二地址。
S240,所述服务端向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址。
如前述例子中,当将读取的任一客户端的第一地址的IP地址与第一客户端的第一地址的IP地址比对一致,则可以认为查找到第二客户端。
当然,在实际应用中,同一局域网的客户端的数量可能会达到上千个,因此,可能会从上千个客户端中选出多个客户端与服务端建立长连接,当服务端与同一局域网中多个客户端建立长连接时,若该局域网中第一客户端请求与服务端建立连接,则服务端可以从表1中查找到多个待选的第二客户端。在查找到多个待选的第二客户端时,可以根据预设的算法,从上述多个待选的第二客户端中选取一个最终的第二客户端。此处,预设的算法的作用可以是对上述多个待选的第二客户端的稳定性进行比较,将稳定性最高的第二客户端选取为最终的第二客户端,或者也可以是计算多个待选的第二客户端的资源消耗量,将资源消耗量最小的第二客户端选取为最终的第二客户端。
如前述例子,假设查找到的或者选取的第二客户端为图1中的客户端00,则服务端从表1中读取客户端00的第二地址,向客户端01返回第一应答消息,该第一应答消息包含:192.168.0.0和2110,即包含第二客户端的第二地址。
S250,所述第一客户端根据所述第二客户端的第二地址,建立与所述第二客户端的连接。
即所述第一应答消息用于指示所述第二客户端与所述第二客户端建立连接。
如前述例子,客户端01在接收到第一应答消息之后,根据客户端00的第二地址的IP地址:192.168.0.0和监听端口:2110向客户端00发送连接请求,客户端00根据接收到的连接请求向客户端01返回应答消息之后,便建立了客户端00与客户端01的连接。
可选地,在执行步骤S250之后,所述方法还可以包括如下步骤:
第一客户端向服务端发送用于表示第一客户端与第二客户端间的连接建立完成的消息;服务端在预设的存储单元中记录第一客户端与第二客户端的对应关系;服务端向第一客户端返回第一指示消息;第一客户端根据第一指示消息,断开与服务端的连接。
如前述例子,客户端01在建立与客户端00的连接之后,向服务端返回用于表示客户端00与客户端01的连接建立完成的消息,服务端在接收到该消息之后,可以在表1中,记录客户端00与客户端01的对应关系,或者,也可以在不同于表1的其它预设的存储单元中记录客户端00与客户端01的对应关系。当记录在表1中时,更新后的表1的内容可以如表2所示。
表2
Figure PCTCN2016095681-appb-000002
表2中,在记录客户端00与客户端01的对应关系的同时,还可以记录客户端01的第二地址的IP地址和监听端口。
服务端在表2中记录客户端00与客户端01的对应关系之后,向客户端01返回第一指示消息,该第一指示消息用于指示客户端01断开与服务端的连接。
可以理解的是,在建立第一客户端与第二客户端的连接关系之后,所述服务端经由所述第二客户端与所述第一客户端进行数据传输。
具体地,当服务端向第一客户端发送数据消息时,从第一客户端与第二客户端的对应关系中获取第二客户端,并从预设的存储单元中读取第二客户端的第一地址;
根据第二客户端的第一地址,向第二客户端发送第一标示消息,第一标示消息用于指示第二客户端向第一客户端发送第一通知消息,第一通知消息用于指示第一客户端向服务端发送第二连接请求,以建立服务端与第一客户端的连接;
向所述第一客户端发送所述数据消息,并在所述数据消息发送完成后,向所述第一客户端返回第二指示消息,所述第二指示消息用于指示所述第一客户端断开与所述服务端的连接。
参见图3所示的本发明提供的信息交互图,图3中,当服务端向客户端01发送消息时,首先从表1的列“与服务端已建立长连接的客户端”中查找客户端01,如果查找到,则直接根据客户端01的第一地址,向客户端01发送消息;如果查找不到,说明服务端未与其建立长连接,此时,如果客户端01与客户端00的对应关系记录到表1中,则从表1中读取与客户端01对应的客户端00,否则从其它预设的存储单元中读取与客户端01对应的客户端00;之后,从表1中读取客户端00的第一地址的IP地址和端口。
图3中,在服务端读取到客户端00的第一地址后,向客户端00发送第一标示消息,该第一标示消息可以为客户端01的第二地址的IP地址:192.168.0.1。客户端00在接收到该第一标示消息之后,向客户端01发送第一通知消息,该第一通知消息用于指示客户端01向服务端发送第二连接请求,待服务端向客户端01返回第二应答消息之后,便建立了服务端与客户端01间的连接。在服务端与客户端01间建立连接之后,服务端向客户端01发送数据消息,并在数据消息发送完成后,服务端向客户端01返回第二 指示消息,该第二指示消息用于指示客户端01断开与服务端的连接。由此,可以有效减少服务端与客户端间的长连接数,从而可以达到节省网络资源的目的。
需要进一步说明的是,上述各步骤描述的是在预设的存储单元中查找到第二客户端的情况,当未查找到第二客户端时,本发明实施例还可以包括如下步骤:
若所述服务端未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,并向所述第一客户端返回第二应答消息;
所述第一客户端根据接收的所述第二应答消息,建立与所述服务端的连接。
当预设的存储单元中各客户端的第一地址的IP地址与第一客户端的第一地址的IP地址均比对不一致;或者,查找的多个待选的第二客户端均为满负载,也即根据预设的算法,从多个待选的第二客户端中不能选取出最终的第二客户端时,则认为未查找到第二客户端。
如前述例子,若未查找到客户端00,则服务端在表1中记录客户端01的第一地址和第二地址,并向客户端01返回第二应答消息,以建立服务端与客户端01的连接。为了保持服务端与客户端01间的长连接,客户端01向服务端发送心跳消息,该心跳消息用于维持服务端与客户端01间的连接。
图4为本发明实施例二提供的数据连接的建立方法流程图。所述方法的执行主体可以为图1中的服务端,如图4所示,所述方法具体可以包括:
S410,服务端接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址。
在此说明,第一客户端可以为图1中的任一客户端,其在向外网中的服务端发送第一连接请求时,协议栈会为其分配相应的第一地址,其中,第一客户端的第一地址可以包括第一客户端的IP地址和端口。
举例来说,第一客户端的第一地址的IP地址为:218.25.245.2。第一 客户端的端口为:a,则上述第一连接请求可以包含:218.25.245.2,此外,第一连接请求还可以包含端口a。
S420,根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端。
此处,预设的存储单元用于存储数据,可以为预设设置的关系数据库或者文件等。而第二客户端可以为与第一客户端属于同一局域网,且与服务端已建立长连接的图1中的客户端,其可以对应第一地址和第二地址。举例来说,第一客户端为图1中的客户端01,且假设客户端00、客户端n0与服务端已建立了长连接,在客户端00的第一地址的IP地址为:218.25.245.2,且客户端00的第二地址的IP地址为:192.168.0.0,客户端n0的第一地址的IP地址为:218.25.245.3,且客户端n0的第二地址的IP地址为:192.168.1.0的情况下,预设的存储单元的内容可以如表1所示。
而S420中根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端的过程具体可以为:依次读取预设的存储单元的各客户端的第一地址的IP地址,并将读取的各客户端的第一地址的IP地址与第一客户端的第一地址的IP地址进行比对。
S430,若查找到所述第二客户端,则读取所述第二客户端的第二地址,向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
如前述例子中,当将读取的任一客户端的第一地址的IP地址与第一客户端的第一地址的IP地址比对一致,则可以认为查找到第二客户端。
当然,在实际应用中,同一局域网的客户端的数量可能会达到上千个,因此,可能会从上千个客户端中选出多个客户端与服务端建立长连接,当服 务端与同一局域网中多个客户端建立长连接时,若该局域网中第一客户端请求与服务端建立连接,则服务端可以从表1中查找到多个待选的第二客户端。在查找到多个待选的第二客户端时,可以根据预设的算法,从上述多个待选的第二客户端中选取一个最终的第二客户端。此处,预设的算法的作用可以是对上述多个待选的第二客户端的稳定性进行比较,将稳定性最高的第二客户端选取为最终的第二客户端,或者也可以是计算多个待选的第二客户端的资源消耗量,将资源消耗量最小的第二客户端选取为最终的第二客户端。
如前述例子,假设查找到的或者选取的第二客户端为图1中的客户端00,则服务端从表1中读取客户端00的第二地址,向客户端01返回第一应答消息,该第一应答消息包含:192.168.0.0和2110,即包含第二客户端的第二地址。客户端01在接收到第一应答消息之后,根据客户端00的第二地址的IP地址:192.168.0.0和监听端口:2110向客户端00发送连接请求,客户端00根据接收到的连接请求向客户端01返回应答消息之后,便建立了客户端00与客户端01的连接。
可选地,在执行步骤S430之后,所述方法还可以包括如下步骤:
第一客户端向服务端发送用于表示第一客户端与第二客户端间的连接建立完成的消息;服务端在预设的存储单元中记录第一客户端与第二客户端的对应关系;服务端向第一客户端返回第一指示消息;第一客户端根据第一指示消息,断开与服务端的连接。
可以理解的是,在建立第一客户端与第二客户端的连接之后,服务端可经由第二客户端与第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
可选地,当所述第一客户端与所述第二客户端断开连接时,本发明实施例还可以包括如下步骤:
接收所述第一客户端发送的第三连接请求;
从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第 一客户端属于同一局域网的客户端;
若查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
所述服务端经由所述第三客户端与所述第一客户端进行数据传输。
举例来说,当客户端00离开与客户端01所属的局域网(如,离开wifi热点范围,或者从wifi网络切换到蜂窝网络,也或者客户端i0关机)时,客户端01在预设的时间范围内就会接收不到客户端00发送的消息,由此,客户端01判断与客户端00断开连接,此时,服务端接收到客户端01发送的第三连接请求,服务端在接收到第三请求之后,从预设的存储单元中查找第三客户端,此处,第三客户端与客户端01属于同一局域网,且第三客户端与服务端建立了连接,若查找到,则向客户端01返回第三客户端的第二地址,以使客户端01根据第三客户端的第二地址,建立与第三客户端的连接。
需要说明的是,第三客户端与第一客户端建立连接的过程可参见步骤S430中第二客户端与第一客户端建立连接的过程,在此不作赘述。
此外,在建立第一客户端与第三客户端的连接关系之后,所述服务端经由所述第三客户端与所述第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
若未查找到第三客户端,则返回第三应答消息,该第三应答消息不包含第三客户端的第二地址;第一客户端根据第三应答消息,建立与服务端的连接。
可选地,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还可以包括如下步骤:
接收所述第一客户端发送的第四连接请求;
根据所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
所述服务端经由所述第四客户端与所述第一客户端进行数据传输。
如前述例子,当服务端在预设的时间范围内未接收到客户端00发送的心跳消息,则服务端判断其与客户端00断开连接;或者当服务端根据从客户端00接收到的消息,判断客户端00的连接地址发生变化,此时,若服务端接收到客户端01发送的第四连接请求,根据第四连接请求中携带的客户端01的第一地址,从预设的存储单元中查找第四客户端,此处,第四客户端与客户端01属于同一局域网,且第四客户端与服务端建立了连接,若查找到,则向客户端01返回第四客户端的第二地址,以使客户端01根据第四客户端的第二地址,建立与第四客户端的连接。
需要说明的是,第四客户端与第一客户端建立连接的过程可参见步骤S430中第二客户端与第一客户端建立连接的过程,在此不作赘述。
此外,在建立第一客户端与第四客户端的连接关系之后,所述服务端经由所述第四客户端与所述第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
若未查找到第四客户端,则返回第四应答消息,该第四应答消息不包含第四客户端的第二地址;第一客户端根据第四应答消息,建立与服务端的连接。
可选地,步骤S410中的第一连接请求还可以包含第一客户端的第二地址。
需要说明的是,上述实施例描述的是在预设的存储单元中查找到第二客户端的情况,当未查找到第二客户端时,本发明实施例还可以包括如下步骤:
若未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
当预设的存储单元中各客户端的第一地址的IP地址与第一客户端的第 一地址的IP地址均比对不一致;或者,查找的多个待选的第二客户端均为满负载,也即根据预设的算法,从多个待选的第二客户端中不能选取出最终的第二客户端时,则认为未查找到第二客户端。
如前述例子,若未查找到客户端00,则服务端在表1中记录客户端01的第一地址和第二地址,并向客户端01返回第二应答消息,以建立服务端与客户端01的连接。为了保持服务端与客户端01间的长连接,客户端01向服务端发送心跳消息,该心跳消息用于维持服务端与客户端01间的连接。
本发明实施例提供的数据连接的建立方法,服务端在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后,断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
图5为本发明实施例三提供的数据连接的建立方法示意图,所述方法的执行主体可以为图1中的客户端,如图5所示,所述方法具体可以包括:
S510,第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址。
在此说明,第一客户端可以为图1中的任一客户端,其在向外网中的服务端发送第一连接请求时,协议栈会为其分配相应的第一地址,其中,第一客户端的第一地址可以包括第一客户端的IP地址和端口。
举例来说,第一客户端的第一地址的IP地址为:218.25.245.2。第一客户端的端口为:a,则上述第一连接请求可以包含:218.25.245.2,此外,第一连接请求还可以包含端口a。
此处,服务端在接收到第一客户端发送的第一连接请求之后,根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端。此处,预设的存储单元用于存储数据,可以为预设设置的关系数据库或者文件等。而第 二客户端可以为与第一客户端属于同一局域网,且与服务端已建立长连接的图1中的客户端,其可以对应第一地址和第二地址。举例来说,第一客户端为图1中的客户端01,且假设客户端00、客户端n0与服务端已建立了长连接,在客户端00的第一地址的IP地址为:218.25.245.2,且客户端00的第二地址的IP地址为:192.168.0.0,客户端n0的第一地址的IP地址为:218.25.245.3,且客户端n0的第二地址的IP地址为:192.168.1.0的情况下,预设的存储单元的内容可以如表1所示。表1中,客户端00、客户端n0与服务端已建立了长连接,而AA为与客户端00属于同一局域网的客户端(或者设备),BB为与客户端n0属于同一局域网的客户端(或者设备)。当然,上述表1的内容只是预设的存储单元的一种实现方式,在其它实现方式中,也可以不存储第一地址的端口,如,可以不存储端口a和端口b。
而根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端的过程具体可以为:依次读取预设的存储单元的各客户端的第一地址的IP地址,并将读取的各客户端的第一地址的IP地址与第一客户端的第一地址的IP地址进行比对。
S520,接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端。
如前述例子中,当将读取的任一客户端的第一地址的IP地址与第一客户端的第一地址的IP地址比对一致,则可以认为查找到第二客户端。
当然,在实际应用中,同一局域网的客户端的数量可能会达到上千个,因此,可能会从上千个客户端中选出多个客户端与服务端建立长连接,当服务端与同一局域网中多个客户端建立长连接时,若该局域网中第一客户端请求与服务端建立连接,则服务端可以从表1中查找到多个待选的第二客户端。在查找到多个待选的第二客户端时,可以根据预设的算法,从上述多个待选的第二客户端中选取一个最终的第二客户端。此处,预设的算法的作用可以 是对上述多个待选的第二客户端的稳定性进行比较,将稳定性最高的第二客户端选取为最终的第二客户端,或者也可以是计算多个待选的第二客户端的资源消耗量,将资源消耗量最小的第二客户端选取为最终的第二客户端。
如前述例子,假设查找到的或者选取的第二客户端为图1中的客户端00,则服务端从表1中读取客户端00的第二地址,向客户端01返回第一应答消息,该第一应答消息包含:192.168.0.0和2110,即包含第二客户端的第二地址。
S530,根据所述第一应答消息,建立与所述第二客户端的连接。
即所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
客户端01在接收到第一应答消息之后,根据客户端00的第二地址的IP地址:192.168.0.0和监听端口:2110向客户端00发送连接请求,客户端00根据接收到的连接请求向客户端01返回应答消息之后,便建立了客户端00与客户端01的连接。
可选地,在执行步骤S530之后,所述方法还可以包括如下步骤:
第一客户端向服务端发送用于表示第一客户端与第二客户端间的连接建立完成的消息;服务端在预设的存储单元中记录第一客户端与第二客户端的对应关系;服务端向第一客户端返回第一指示消息;第一客户端根据第一指示消息,断开与服务端的连接。
可以理解的是,在建立第一客户端与第二客户端的连接之后,服务端可经由第二客户端与第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
可选地,当所述第一客户端与所述第二客户端断开连接时,本发明实施例还可以包括如下步骤:
向所述服务端发送第三连接请求;
接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户 端的第二地址,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
根据所述第三应答消息,建立与所述第三客户端的连接;
所述第一客户端经由所述第三客户端与所述服务端进行数据传输。
举例来说,当客户端00离开与客户端01所属的局域网(如,离开wifi热点范围,或者从wifi网络切换到蜂窝网络,也或者客户端i0关机)时,客户端01在预设的时间范围内就会接收不到客户端00发送的消息,由此,客户端01判断与客户端00断开连接,此时,服务端接收到客户端01发送的第三连接请求,服务端在接收到第三请求之后,从预设的存储单元中查找第三客户端,此处,第三客户端与客户端01属于同一局域网,且第三客户端与服务端建立了连接,若查找到,则向客户端01返回第三客户端的第二地址,以使客户端01根据第三客户端的第二地址,建立与第三客户端的连接。
需要说明的是,第三客户端与第一客户端建立连接的过程可参见步骤S530中第二客户端与第一客户端建立连接的过程,在此不作赘述。
此外,在建立第一客户端与第三客户端的连接关系之后,所述服务端经由所述第三客户端与所述第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
若未查找到第三客户端,则返回第三应答消息,该第三应答消息不包含第三客户端的第二地址;第一客户端根据第三应答消息,建立与服务端的连接。
可选地,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还可以包括如下步骤:
向所述服务端发送第四连接请求;
接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述第一客户端属于同一局域网的客户 端;
根据所述第四应答消息,建立与所述第四客户端的连接;
所述第一客户端经由所述第四客户端与所述服务端进行数据传输。
如前述例子,当服务端在预设的时间范围内未接收到客户端00发送的心跳消息,则服务端判断其与客户端00断开连接;或者当服务端根据从客户端00接收到的消息,判断客户端00的连接地址发生变化,此时,若服务端接收到客户端01发送的第四连接请求,根据第四连接请求中携带的客户端01的第一地址,从预设的存储单元中查找第四客户端,此处,第四客户端与客户端01属于同一局域网,且第四客户端与服务端建立了连接,若查找到,则向客户端01返回第四客户端的第二地址,以使客户端01根据第四客户端的第二地址,建立与第四客户端的连接。
需要说明的是,第四客户端与第一客户端建立连接的过程可参见步骤S530中第二客户端与第一客户端建立连接的过程,在此不作赘述。
此外,在建立第一客户端与第四客户端的连接关系之后,所述服务端经由所述第四客户端与所述第一客户端进行数据传输,其具体传输过程如本发明实施例一所述,在此不作赘述。
若未查找到第四客户端,则返回第四应答消息,该第四应答消息不包含第四客户端的第二地址;第一客户端根据第四应答消息,建立与服务端的连接。
可选地,步骤S510中的第一连接请求还可以包含第一客户端的第二地址。
需要说明的是,上述实施例描述的是在第二应答消息包含第二客户端的第二地址的情况,当第二应答消息不包含第二客户端的第二地址时,本发明实施例还可以包括如下步骤:
接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
根据所述第二应答消息,建立与所述服务端的连接。
当预设的存储单元中各客户端的第一地址的IP地址与第一客户端的第一地址的IP地址均比对不一致;或者,查找的多个待选的第二客户端均为满负载,也即根据预设的算法,从多个待选的第二客户端中不能选取出最终的第二客户端时,则认为未查找到第二客户端,则服务端向第一客户端返回的第二应答消息中不包含第二客户端的第二地址。
如前述例子,若未查找到客户端00,则服务端在表1中记录客户端01的第一地址和第二地址,并向客户端01返回第二应答消息,以建立服务端与客户端01的连接。为了保持服务端与客户端01间的长连接,客户端01向服务端发送心跳消息,该心跳消息用于维持服务端与客户端01间的连接。
本发明实施例提供的数据连接的建立方法,服务端在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后,断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
图6为本发明实施例四提供的服务端示意图。所述服务端可以用于执行图4所述的方法。图6中,该服务端包括:接收单元601、查找单元602和读取单元603。
接收单元601,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址。
查找单元602,用于根据接收单元601接收的所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端。
读取单元603,用于若查找单元602查找到所述第二客户端,则读取所 述第二客户端的第二地址。
发送单元604,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
可选地,所述服务端还包括:保存单元605;
保存单元605,用于若查找单元602未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
可选地,所述服务端还包括:第一传输单元606;
第一传输单元606,用于经由所述第二客户端与所述第一客户端进行数据传输。
可选地,所述服务端还包括:第一指示单元607和第二传输单元608;
接收单元601,还用于接收所述第一客户端发送的第三连接请求;
查找单元602,还用于从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
第一指示单元607,用于若查找单元602查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
第二传输单元608,还用于经由所述第三客户端与所述第一客户端进行数据传输。
可选地,所述服务端还包括:第二指示单元609和第三传输单元610;
接收单元601,还用于接收所述第一客户端发送的第四连接请求;
查找单元602,还用于根据接收单元601接收的所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
第二指示单元609,用于若查找单元602查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
第三传输单元610,用于经由所述第四客户端与所述第一客户端进行数据传输。
本发明实施例装置的各功能模块的功能,可以通过上述方法实施例的各步骤来实现,因此,本发明提供的装置的具体工作过程,在此不复赘述。
本发明实施例提供的服务端,在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后,断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
图7为本发明实施例五提供的移动终端示意图。所述移动终端可以用于执行图5所述的方法。图7中,该移动终端包括:发送单元701、接收单元702和建立单元703。
发送单元701,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址。
接收单元702,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属于同一局域网的客户端。
建立单元703,用于根据接收单元702接收的所述第一应答消息,建立与所述第二客户端的连接。
可选地,接收单元702,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
建立单元703,还用于根据接收单元702接收的所述第二应答消息,建立与所述服务端的连接。
可选地,所述移动终端还包括:第一传输单元704;
第一传输单元704,用于经由所述第二客户端与所述服务端进行数据传 输。
可选地,所述移动终端还包括:第二传输单元705;
发送单元701,还用于向所述服务端发送第三连接请求;
接收单元702,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
建立单元703,还用于根据接收单元702接收的所述第三应答消息,建立与所述第三客户端的连接;
第二传输单元705,用于经由所述第三客户端与所述服务端进行数据传输。
可选地,所述移动终端还包括:第三传输单元706;
发送单元701,还用于向所述服务端发送第四连接请求;
接收单元702,还用于接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
建立单元703,还用于根据接收单元702接收的所述第四应答消息,建立与所述第四客户端的连接;
第三传输单元706,用于经由所述第四客户端与所述服务端进行数据传输。
本发明实施例装置的各功能模块的功能,可以通过上述方法实施例的各步骤来实现,因此,本发明提供的装置的具体工作过程,在此不复赘述。
本发明实施例提供的移动终端,在接收到第一客户端发送的连接请求时,判断是否与第一客户端属于同一局域网的第二客户端已建立了连接,如果是,则向第一客户端返回用于指示第一客户端与第二客户端建立连接的应答消息,且在第一客户端与第二客户端的连接建立完成后断开与第一客户端的连接,由此,可以有效减少设备间的长连接数,从而可以达到节省网络资 源的目的。
图8为本发明实施例六提供的服务端示意图。如图8所示,所述服务端包括:接收器801、处理器802、存储器803、通信接口804、发送器805和总线806,其中,接收器801、处理器802、存储器803、通信接口804和发送器805通过总线806通信。
举例来说,处理器802可以是CPU。
通信接口804用于与其它设备通信。
存储器803可以是永久存储器,例如硬盘驱动器和闪存,存储器803中具有软件模块和设备驱动程序。软件模块能够执行本发明上述方法的各种功能模块;设备驱动程序可以是网络和接口驱动程序。
接收器801,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
处理器802,用于根据接收器801接收的所述第一客户端的第一地址,从所述存储器中查找第二客户端,其中,所述存储器用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
处理器802,还用于若查找到所述第二客户端,则读取所述第二客户端的第二地址;
发送器805,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
可选地,存储器803,用于若所述处理器未查找到所述第二客户端,则在所述存储器中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
可选地,通信接口804,用于经由所述第二客户端与所述第一客户端进行数据传输。
可选地,接收器801,还用于接收所述第一客户端发送的第三连接请求;
处理器802,还用于从存储器803中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
处理器802,还用于若查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
通信接口804,还用于经由所述第三客户端与所述第一客户端进行数据传输。
可选地,接收器801,还用于接收所述第一客户端发送的第四连接请求;
处理器802,还用于根据接收器801接收的所述第四连接请求,从所述存储器中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
处理器802,还用于若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
通信接口804,还用于经由所述第四客户端与所述第一客户端进行数据传输。
本发明实施例提供的服务端,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
图9为本发明实施例七提供的移动终端示意图。如图9所示,所述移动终端包括:发送器901、接收器902、处理器903、通信接口904和总线905,其中,发送器901、接收器902、处理器903和通信接口904通过总线905通信。
举例来说,处理器903可以是CPU。
通信接口904用于与其它设备通信。
所述移动终端还可以包括存储器906,存储器906也通过***总线905与处理器903连接。存储器906可以是永久存储器,例如硬盘驱动器和闪存,存储器906中具有软件模块和设备驱动程序。软件模块能够执行本发明上述 方法的各种功能模块;设备驱动程序可以是网络和接口驱动程序。
发送器901,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址。
接收器902,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属于同一局域网的客户端。
处理器903,用于根据接收器902接收的所述第一应答消息,建立与所述第二客户端的连接。
可选地,接收器902,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
处理器903,还用于根据接收器902接收的所述第二应答消息,建立与所述服务端的连接。
可选地,通信接口904,用于经由所述第二客户端与所述服务端进行数据传输。
可选地,发送器901,还用于向所述服务端发送第三连接请求;
接收器902,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
处理器903,还用于根据接收器902接收的所述第三应答消息,建立与所述第三客户端的连接;
通信接口904,还用于经由所述第三客户端与所述服务端进行数据传输。
可选地,发送器901,还用于向所述服务端发送第四连接请求;
接收器902,还用于接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
处理903器,还用于根据接收器902接收的所述第四应答消息,建立与 所述第四客户端的连接;
通信接口904,还用于经由所述第四客户端与所述服务端进行数据传输。
本发明实施例提供的移动终端,可以有效减少设备间的长连接数,从而可以达到节省网络资源的目的。
专业人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (33)

  1. 一种数据连接的建立方法,其特征在于,所述方法包括:
    第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
    所述服务端根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
    若所述服务端查找到所述第二客户端,则读取所述第二客户端的第二地址,向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;
    所述第一客户端根据所述第二客户端的第二地址,建立与所述第二客户端的连接。
  2. 根据权利要求1所述的方法,其特征在于,所述第一连接请求还包含第一客户端的第二地址,所述方法还包括:
    若所述服务端未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,并向所述第一客户端返回第二应答消息;
    所述第一客户端根据接收的所述第二应答消息,建立与所述服务端的连接。
  3. 根据权利要求1或2所述的方法,其特征在于,在所述建立与所述第一客户端的连接之后,所述方法还包括:
    所述服务端经由所述第二客户端与所述第一客户端进行数据传输。
  4. 一种数据连接的建立方法,其特征在于,所述方法包括:
    服务端接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
    根据所述第一客户端的第一地址,从预设的存储单元中查找第二客户 端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
    若查找到所述第二客户端,则读取所述第二客户端的第二地址,向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;
    所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
  5. 根据权利要求4所述的方法,其特征在于,所述第一连接请求还包含第一客户端的第二地址,所述方法还包括:
    若未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
  6. 根据权利要求4或5所述的方法,其特征在于,所述方法还包括:
    所述服务端经由所述第二客户端与所述第一客户端进行数据传输。
  7. 根据权利要求4-6任一项述的方法,其特征在于,当所述第一客户端与所述第二客户端断开连接时,所述方法还包括:
    接收所述第一客户端发送的第三连接请求;
    从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
    若查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
    所述服务端经由所述第三客户端与所述第一客户端进行数据传输。
  8. 根据权利要求4-7任一项所述的方法,其特征在于,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还包括:
    接收所述第一客户端发送的第四连接请求;
    根据所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
    若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
    所述服务端经由所述第四客户端与所述第一客户端进行数据传输。
  9. 一种数据连接的建立方法,其特征在于,所述方法包括:
    第一客户端向服务端发送第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
    接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
    根据所述第一应答消息,建立与所述第二客户端的连接。
  10. 根据权利要求9所述的方法,其特征在于,所述方法还包括:
    接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
    根据所述第二应答消息,建立与所述服务端的连接。
  11. 根据权利要求9或10所述的方法,其特征在于,所述方法还包括:
    所述第一客户端经由所述第二客户端与所述服务端进行数据传输。
  12. 根据权利要求9-11任一项所述的方法,其特征在于,当所述第一客户端与所述第二客户端断开连接时,所述方法还包括:
    向所述服务端发送第三连接请求;
    接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
    根据所述第三应答消息,建立与所述第三客户端的连接;
    所述第一客户端经由所述第三客户端与所述服务端进行数据传输。
  13. 根据权利要求9-12任一项所述的方法,其特征在于,当所述第二客户端的连接地址发生变化或者所述服务端与所述第二客户端断开连接时,所述方法还包括:
    向所述服务端发送第四连接请求;
    接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
    根据所述第四应答消息,建立与所述第四客户端的连接;
    所述第一客户端经由所述第四客户端与所述服务端进行数据传输。
  14. 一种服务端,其特征在于,所述服务端包括:接收单元、查找单元和读取单元;
    所述接收单元,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
    所述查找单元,用于根据所述接收单元接收的所述第一客户端的第一地址,从预设的存储单元中查找第二客户端,其中,所述预设的存储单元用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
    所述读取单元,用于若所述查找单元查找到所述第二客户端,则读取所述第二客户端的第二地址;
    所述发送单元,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
  15. 根据权利要求14所述的服务端,其特征在于,所述服务端还包括:保存单元;
    所述保存单元,用于若所述查找单元未查找到所述第二客户端,则在所述预设的存储单元中存储所述第一客户端的第二地址,建立与所述第一客户 端的连接。
  16. 根据权利要求14或15所述的服务端,其特征在于,所述服务端还包括:第一传输单元;
    所述第一传输单元,用于经由所述第二客户端与所述第一客户端进行数据传输。
  17. 根据权利要求14-16任一项所述的服务端,其特征在于,所述服务端还包括:第一指示单元和第二传输单元;
    所述接收单元,还用于接收所述第一客户端发送的第三连接请求;
    所述查找单元,还用于从所述预设的存储单元中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
    所述第一指示单元,用于若所述查找单元查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
    所述第二传输单元,还用于经由所述第三客户端与所述第一客户端进行数据传输。
  18. 根据权利要求14-17任一项所述的服务端,其特征在于,所述服务端还包括:第二指示单元和第三传输单元;
    所述接收单元,还用于接收所述第一客户端发送的第四连接请求;
    所述查找单元,还用于根据所述接收单元接收的所述第四连接请求,从所述预设的存储单元中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
    所述第二指示单元,用于若所述查找单元查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
    所述第三传输单元,用于经由所述第四客户端与所述第一客户端进行数据传输。
  19. 一种移动终端,其特征在于,所述移动终端包括:发送单元、接收单元和建立单元;
    所述发送单元,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址;
    所述接收单元,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属于同一局域网的客户端;
    所述建立单元,用于根据所述接收单元接收的所述第一应答消息,建立与所述第二客户端的连接。
  20. 根据权利要求19所述的移动终端,其特征在于,
    所述接收单元,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
    所述建立单元,还用于根据所述接收单元接收的所述第二应答消息,建立与所述服务端的连接。
  21. 根据权利要求19或20所述的移动终端,其特征在于,所述移动终端还包括:第一传输单元;
    所述第一传输单元,用于经由所述第二客户端与所述服务端进行数据传输。
  22. 根据权利要求19-21任一项所述的移动终端,其特征在于,所述移动终端还包括:第二传输单元;
    所述发送单元,还用于向所述服务端发送第三连接请求;
    所述接收单元,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
    所述建立单元,还用于根据所述接收单元接收的所述第三应答消息,建立与所述第三客户端的连接;
    所述第二传输单元,用于经由所述第三客户端与所述服务端进行数据传输。
  23. 根据权利要求19-22任一项所述的移动终端,其特征在于,所述移动终端还包括:第三传输单元;
    所述发送单元,还用于向所述服务端发送第四连接请求;
    所述接收单元,还用于接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
    所述建立单元,还用于根据所述接收单元接收的所述第四应答消息,建立与所述第四客户端的连接;
    所述第三传输单元,用于经由所述第四客户端与所述服务端进行数据传输。
  24. 一种服务端,其特征在于,所述服务端包括:接收器、处理器、存储器、通信接口和发送器;
    所述接收器,用于接收第一客户端发送的第一连接请求,所述第一连接请求包含所述第一客户端的第一地址;
    所述处理器,用于根据所述接收器接收的所述第一客户端的第一地址,从所述存储器中查找第二客户端,其中,所述存储器用于存储与所述服务端已建立连接的所有客户端以及所有客户端的第一地址和第二地址,所述第二客户端为与所述第一客户端属于同一局域网的客户端;
    所述处理器,还用于若查找到所述第二客户端,则读取所述第二客户端的第二地址;
    所述发送器,用于向所述第一客户端返回第一应答消息,所述第一应答消息包含所述第二客户端的第二地址;所述第一应答消息用于指示所述第一客户端与所述第二客户端建立连接。
  25. 根据权利要求24所述的服务端,其特征在于,
    所述存储器,用于若所述处理器未查找到所述第二客户端,则在所述存储器中存储所述第一客户端的第二地址,建立与所述第一客户端的连接。
  26. 根据权利要求24或25所述的服务端,其特征在于,
    所述通信接口,用于经由所述第二客户端与所述第一客户端进行数据传输。
  27. 根据权利要求24-26任一项所述的服务端,其特征在于,
    所述接收器,还用于接收所述第一客户端发送的第三连接请求;
    所述处理器,还用于从所述存储器中查找第三客户端,所述第三客户端为与所述第一客户端属于同一局域网的客户端;
    所述处理器,还用于若查找到所述第三客户端,则指示所述第一客户端建立与第三客户端的连接;
    所述通信接口,还用于经由所述第三客户端与所述第一客户端进行数据传输。
  28. 根据权利要求24-27任一项所述的服务端,其特征在于,
    所述接收器,还用于接收所述第一客户端发送的第四连接请求;
    所述处理器,还用于根据所述接收器接收的所述第四连接请求,从所述存储器中查找第四客户端,所述第四客户端为与所述第一客户端属于同一局域网的客户端;
    所述处理器,还用于若查找到所述第四客户端,则指示所述第一客户端与所述第四客户端建立连接;
    所述通信接口,还用于经由所述第四客户端与所述第一客户端进行数据传输。
  29. 一种移动终端,其特征在于,所述移动终端包括:发送器、接收器、处理器和通信接口;
    所述发送器,用于向服务端发送第一连接请求,所述第一连接请求包含所述移动终端的第一地址;
    所述接收器,用于接收所述服务端发送的第一应答消息,所述第一应答消息包含所述第二客户端的第二地址,所述第二客户端为与所述移动终端属 于同一局域网的客户端;
    所述处理器,用于根据所述接收器接收的所述第一应答消息,建立与所述第二客户端的连接。
  30. 根据权利要求29所述的移动终端,其特征在于,
    所述接收器,还用于接收所述服务端发送的第二应答消息,所述第二应答消息不包含所述第二客户端的第二地址;
    所述处理器,还用于根据所述接收器接收的所述第二应答消息,建立与所述服务端的连接。
  31. 根据权利要求29或30所述的移动终端,其特征在于,
    所述通信接口,用于经由所述第二客户端与所述服务端进行数据传输。
  32. 根据权利要求29-31任一项所述的移动终端,其特征在于,
    所述发送器,还用于向所述服务端发送第三连接请求;
    所述接收器,还用于接收所述服务端发送的第三应答消息,所述第三应答消息包含第三客户端的第二地址,所述第三客户端为与所述移动终端属于同一局域网的客户端;
    所述处理器,还用于根据所述接收器接收的所述第三应答消息,建立与所述第三客户端的连接;
    所述通信接口,还用于经由所述第三客户端与所述服务端进行数据传输。
  33. 根据权利要求29-32任一项所述的移动终端,其特征在于,
    所述发送器,还用于向所述服务端发送第四连接请求;
    所述接收器,还用于接收所述服务端发送的第四应答消息,所述第四应答消息包含第四客户端的第二地址,所述第四客户端为与所述移动终端属于同一局域网的客户端;
    所述处理器,还用于根据所述接收器接收的所述第四应答消息,建立与所述第四客户端的连接;
    所述通信接口,还用于经由所述第四客户端与所述服务端进行数据传输。
PCT/CN2016/095681 2015-09-02 2016-08-17 数据连接的建立方法、服务端及移动终端 WO2017036305A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US15/756,916 US10693967B2 (en) 2015-09-02 2016-08-17 Data connection establishment method, server, and mobile terminal
EP16840734.4A EP3334095B1 (en) 2015-09-02 2016-08-17 Method for establishing data connection, server side, and mobile terminal

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510559594.4A CN106487864B (zh) 2015-09-02 2015-09-02 数据连接的建立方法、服务端及移动终端
CN201510559594.4 2015-09-02

Publications (1)

Publication Number Publication Date
WO2017036305A1 true WO2017036305A1 (zh) 2017-03-09

Family

ID=58186644

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/095681 WO2017036305A1 (zh) 2015-09-02 2016-08-17 数据连接的建立方法、服务端及移动终端

Country Status (4)

Country Link
US (1) US10693967B2 (zh)
EP (1) EP3334095B1 (zh)
CN (1) CN106487864B (zh)
WO (1) WO2017036305A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230412675A1 (en) * 2017-10-05 2023-12-21 Level 3 Communications, Llc Cdn-based client messaging

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106487864B (zh) * 2015-09-02 2019-09-27 华为终端有限公司 数据连接的建立方法、服务端及移动终端
US11159420B2 (en) * 2019-04-17 2021-10-26 Cloudflare, Inc. Method and apparatus of automatic route optimization in a private virtual network for client devices of a local network
CN110601914B (zh) * 2019-08-05 2022-11-22 深圳市大拿科技有限公司 监测服务器存活状态的方法及***
WO2022036650A1 (zh) * 2020-08-20 2022-02-24 深圳市沃特沃德股份有限公司 建立ip数据长连接的方法、5g网关设备和计算机设备
CN112055098B (zh) * 2020-08-20 2023-04-07 深圳市沃特沃德股份有限公司 建立ip数据长连接的方法、5g网关设备和计算机设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009086837A2 (en) * 2008-01-09 2009-07-16 Secomea A/S Communication with a network device over a data network
CN102291808A (zh) * 2011-06-03 2011-12-21 莫雅静 一种网络通信方法、通信设备以及通信设备的中间件
CN102761864A (zh) * 2011-04-29 2012-10-31 ***通信集团公司 一种数据传输的方法、***及设备
CN104009938A (zh) * 2014-06-17 2014-08-27 合一网络技术(北京)有限公司 基于路由层面的长连接的方法和***

Family Cites Families (49)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6665702B1 (en) * 1998-07-15 2003-12-16 Radware Ltd. Load balancing
US7363367B2 (en) * 2000-10-17 2008-04-22 Avaya Technology Corp. Systems and methods for robust, real-time measurement of network performance
US8583745B2 (en) * 2000-11-16 2013-11-12 Opendesign, Inc. Application platform
US7809854B2 (en) * 2002-02-12 2010-10-05 Open Design, Inc. Logical routing system
US20020165973A1 (en) * 2001-04-20 2002-11-07 Doron Ben-Yehezkel Adaptive transport protocol
DE60211897T2 (de) 2001-06-08 2006-10-19 4Th Pass Inc., Seattle Verfahren, Speichermedium, Netwerk und Apparat für eine biderektional initierte Datenkommunikation mit einer drahtlosen Einrichtung
DE60223264T2 (de) 2001-08-29 2008-08-14 Research In Motion Ltd., Waterloo System und verfahren zur adressierung eines mobilen gerätes in einem ip-basierten drahtlosen netzwerk
US7676579B2 (en) * 2002-05-13 2010-03-09 Sony Computer Entertainment America Inc. Peer to peer network communication
JP3797344B2 (ja) * 2002-10-11 2006-07-19 オンキヨー株式会社 サーバクライアントシステム
KR100448635B1 (ko) * 2002-11-27 2004-09-13 한국전자통신연구원 이더넷 기반의 수동 광통신망에서의 통신 노드 시스템,제어 노드 시스템, 및 이를 이용한 통신 시스템
GB0328383D0 (en) * 2003-12-06 2004-01-14 Ibm Improved quality of service for network connected clients
US8065418B1 (en) * 2004-02-02 2011-11-22 Apple Inc. NAT traversal for media conferencing
US7457293B2 (en) * 2004-04-05 2008-11-25 Panasonic Corporation Communication apparatus, method and program for realizing P2P communication
CN100486193C (zh) * 2004-09-29 2009-05-06 腾讯科技(深圳)有限公司 多策略的p2p连接建立方法
JP5005210B2 (ja) * 2005-11-11 2012-08-22 任天堂株式会社 ネットワークゲームシステム、ネットワークゲームプログラムおよびネットワーク構築方法
JP4834410B2 (ja) * 2006-01-26 2011-12-14 株式会社日立製作所 フレーム転送装置
US8219679B2 (en) * 2006-02-28 2012-07-10 International Business Machines Corporation Detection and control of peer-to-peer communication
US8131673B2 (en) * 2006-12-05 2012-03-06 International Business Machines Corporation Background file sharing in a segmented peer-to-peer file sharing network
CN101282232A (zh) * 2007-04-05 2008-10-08 华为技术有限公司 一种远端设备管理方法、设备及***
CN101141420B (zh) * 2007-09-05 2012-07-11 杭州华三通信技术有限公司 私网与公网进行数据通信的方法及***
US8166544B2 (en) * 2007-11-09 2012-04-24 Polytechnic Institute Of New York University Network-based infection detection using host slowdown
KR101548959B1 (ko) * 2008-06-04 2015-09-01 삼성전자주식회사 패킷 통신 시스템에서 네트워크 주소 설정을 위한 장치 및방법
CN101316161B (zh) * 2008-06-25 2011-06-29 广东威创视讯科技股份有限公司 一种分布式视频同步显示方法和***
US20110082941A1 (en) * 2009-10-06 2011-04-07 Electronics And Telecommunications Research Institute Method of providing direct communication in internet protocol network
US9363228B2 (en) * 2009-12-15 2016-06-07 Qualcomm Innovation Center, Inc. Apparatus and method of peer-to-peer communication
US20110307538A1 (en) * 2010-06-10 2011-12-15 Alcatel-Lucent Usa, Inc. Network based peer-to-peer traffic optimization
WO2012030259A1 (en) * 2010-08-31 2012-03-08 Telefonaktiebolaget Lm Ericsson (Publ) Method and arrangement in a peer-to-peer network
CN102447748B (zh) 2010-10-15 2015-04-22 华为技术有限公司 在nat穿越中分配外网互联网协议ip地址的方法及设备、***
CN102480501A (zh) * 2010-11-26 2012-05-30 华为终端有限公司 应用资源下载方法及相关设备
EP2482598A1 (en) * 2011-01-28 2012-08-01 Alcatel Lucent Method to connect a mobile node to a network
EP2482525B1 (en) * 2011-01-28 2014-03-12 NTT DoCoMo, Inc. Method and apparatus for determining a server which should respond to a service request
TWI429308B (zh) * 2011-02-14 2014-03-01 Wistron Corp 建立點對點傳輸的方法及行動通訊系統
KR102033674B1 (ko) * 2012-06-29 2019-10-17 삼성전자주식회사 전자 장치를 위한 인터넷 기반 ars 시스템 및 방법
WO2014030199A1 (ja) 2012-08-20 2014-02-27 富士通株式会社 シームレスアプリプッシュシステム及びその方法
KR20140042465A (ko) * 2012-09-28 2014-04-07 삼성전자주식회사 와이파이 다이렉트를 지원하는 화상 형성 장치 및 그것의 와이파이 다이렉트 연결 방법
US9148765B2 (en) 2012-11-27 2015-09-29 Alcatel Lucent Push service without persistent TCP connection in a mobile network
WO2014121514A1 (zh) * 2013-02-08 2014-08-14 华为技术有限公司 一种实现私网穿越的方法、装置和***
KR101497630B1 (ko) * 2013-04-05 2015-03-03 삼성에스디에스 주식회사 모바일 환경에서의 p2p 접속 시스템 및 단말과 이를 이용한 p2p 접속 방법
US9210536B2 (en) * 2013-05-21 2015-12-08 Google Technology Holdings LLC Method for establishing device-to-device communication
FR3007603A1 (fr) * 2013-06-21 2014-12-26 France Telecom Etablissement de communication entre une application web et un terminal
US20160295597A1 (en) 2013-07-26 2016-10-06 Intel IP Corporation Signaling interference information for user equipment assistance
US20160234307A1 (en) * 2013-09-29 2016-08-11 Beijing Qihoo Technology Company Limited Data transmission method, device, and system
US9535723B2 (en) * 2014-02-21 2017-01-03 International Business Machines Corporation Methods and apparatuses for generating desktop cloud instances based upon mobile device user file selections
CN103812947B (zh) * 2014-02-28 2017-03-15 深圳市创梦天地科技有限公司 数据交互***及方法
JP6138714B2 (ja) * 2014-03-03 2017-05-31 アラクサラネットワークス株式会社 通信装置および通信装置における通信制御方法
US9497197B2 (en) * 2014-05-20 2016-11-15 Box, Inc. Systems and methods for secure resource access and network communication
US10454689B1 (en) * 2015-08-27 2019-10-22 Amazon Technologies, Inc. Digital certificate management
CN106487864B (zh) * 2015-09-02 2019-09-27 华为终端有限公司 数据连接的建立方法、服务端及移动终端
US10511569B2 (en) * 2016-08-15 2019-12-17 Facebook, Inc. Techniques for providing multi-modal multi-party calling

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2009086837A2 (en) * 2008-01-09 2009-07-16 Secomea A/S Communication with a network device over a data network
CN102761864A (zh) * 2011-04-29 2012-10-31 ***通信集团公司 一种数据传输的方法、***及设备
CN102291808A (zh) * 2011-06-03 2011-12-21 莫雅静 一种网络通信方法、通信设备以及通信设备的中间件
CN104009938A (zh) * 2014-06-17 2014-08-27 合一网络技术(北京)有限公司 基于路由层面的长连接的方法和***

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20230412675A1 (en) * 2017-10-05 2023-12-21 Level 3 Communications, Llc Cdn-based client messaging

Also Published As

Publication number Publication date
EP3334095A1 (en) 2018-06-13
CN106487864A (zh) 2017-03-08
CN106487864B (zh) 2019-09-27
US10693967B2 (en) 2020-06-23
EP3334095A4 (en) 2018-10-31
EP3334095B1 (en) 2021-03-17
US20180255145A1 (en) 2018-09-06

Similar Documents

Publication Publication Date Title
WO2017036305A1 (zh) 数据连接的建立方法、服务端及移动终端
US11290418B2 (en) Hybrid content request routing system
US20180109456A1 (en) System, method, and device for network load balance processing
WO2013104172A1 (zh) 实现负载均衡的方法、dns服务器和客户端
CN114095430B (zh) 一种访问报文的处理方法、***及工作节点
WO2017096888A1 (zh) 域名解析***的实现方法及装置
US9979643B2 (en) Communication apparatus, communication method, and computer-readable recording medium
KR20140007363A (ko) 기업 네트워크 외부로부터의 사이트-인식 분산형 파일 시스템 액세스
WO2021223454A1 (zh) 投屏方法和***
CN107070790B (zh) 一种路由学习方法及路由设备
US20120317275A1 (en) Methods and devices for node distribution
US10536368B2 (en) Network-aware routing in information centric networking
WO2020119699A1 (zh) 物联网的资源发布方法、装置、设备及存储介质
CN115442100A (zh) 基于多节点零信任网关的数据访问方法及相关设备
WO2013159667A1 (en) Virtual router redundancy protocol load balancing mode (vrrpe)
WO2018024200A1 (zh) 虚拟桌面组播控制方法、终端、代理终端及云桌面服务器
TWI494008B (zh) 電子裝置的無線網路連線方法及其電子裝置
CN110855810B (zh) 一种nat转换方法、装置、网络安全设备及存储介质
EP3939236B1 (en) Node and cluster management on distributed self-governed ecosystem
CN109347743B (zh) 一种专线通信方法、计算机可读存储介质和终端设备
US20220263759A1 (en) Addressing method, addressing system, and addressing apparatus
US11063869B2 (en) ARP table management system
CN104518983B (zh) 一种多设备间的通信方法及装置
US20230096435A1 (en) Proactive indication of network session disruption
CN114793234B (zh) 消息处理方法、装置、设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16840734

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15756916

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

WWE Wipo information: entry into national phase

Ref document number: 2016840734

Country of ref document: EP