CN109981640B - Connection establishment method and device - Google Patents

Connection establishment method and device Download PDF

Info

Publication number
CN109981640B
CN109981640B CN201910226248.2A CN201910226248A CN109981640B CN 109981640 B CN109981640 B CN 109981640B CN 201910226248 A CN201910226248 A CN 201910226248A CN 109981640 B CN109981640 B CN 109981640B
Authority
CN
China
Prior art keywords
vpn
redis
interface
specified
configuration instruction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910226248.2A
Other languages
Chinese (zh)
Other versions
CN109981640A (en
Inventor
宛清
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou H3C Technologies Co Ltd
Original Assignee
Hangzhou H3C Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou H3C Technologies Co Ltd filed Critical Hangzhou H3C Technologies Co Ltd
Priority to CN201910226248.2A priority Critical patent/CN109981640B/en
Publication of CN109981640A publication Critical patent/CN109981640A/en
Application granted granted Critical
Publication of CN109981640B publication Critical patent/CN109981640B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

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

Abstract

The application provides a connection establishment method and device. In the application, the Redis client is bound with the VPN identification through the specified interface of the specified Redis server connected to the Redis client, so that the Redis server is distinguished based on the VPN identification, and on the premise that the same Redis client is simultaneously connected with at least two different Redis servers (the IP addresses are the same), as long as the VPN identifications bound to the ports connected with the different Redis servers on the Redis client are different, the Redis client can distinguish the different Redis servers through the VPN identification, and TCP connection is successfully established with the different Redis servers with the same IP addresses.

Description

Connection establishment method and device
Technical Field
The present application relates to network communication technologies, and in particular, to a connection establishment method and apparatus.
Background
A Remote dictionary server (Remote dictionary server) is an open source memory-based data structure store that can typically be used as a database. In application, the Redis client is responsible for backing up data to the Redis server.
In a Network application environment, a TCP connection belonging to a public Virtual Private Network (VPN) is established between a Redis client and a Redis server. However, because of the limited IP address resources in the network application environment, the following problems often occur: at least two network devices, such as Redis servers, are assigned the same IP address. As shown in fig. 1, the Redis server 1020 and the Redis server 1021 are assigned the same IP address 192.168.5.10. In this case, because the Redis server 1020 and the Redis server 1021 have IP address conflicts (the IP addresses are the same), the Redis client 1011 cannot successfully establish a TCP connection belonging to the public network VPN with the Redis server 1020 and the Redis server 1021.
Disclosure of Invention
In view of this, the present application provides a connection establishing method and device, so as to implement that a Redis client successfully establishes a TCP connection with each different Redis server having the same IP address in a scenario that the same Redis client is simultaneously connected with different Redis servers having the same IP address.
In a first aspect, the present application provides a connection establishment method, which is applied to a Redis client, and includes:
creating a socket address structure at least comprising a VPN index, wherein the socket address structure corresponds to a created socket, the socket is associated with TCP connection to be established between a Redis client and a specified Redis server, the VPN index is an index of a VPN identifier bound with a specified interface on the Redis client, and the specified interface is an interface for connecting the specified Redis server on the Redis client;
and establishing TCP connection belonging to the VPN corresponding to the VPN identifier between the Redis client and the appointed Redis server according to the VPN index in the socket address structure.
With reference to the first aspect, in a first possible implementation manner, before creating a socket address structure, the method further includes:
receiving a configuration instruction, wherein the configuration instruction is used for indicating that a VPN identifier is bound to a specified interface, and the configuration instruction carries the VPN identifier to be bound with the specified interface;
checking whether the VPN identification carried by the configuration instruction is the same as the VPN identification bound by other interfaces except the specified interface on the Redis client;
if not, binding the VPN identification carried by the configuration instruction with the specified interface;
if yes, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with other interfaces and the IP address of the specified Redis server connected with the specified interface.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, determining whether to bind the VPN identifier carried by the configuration instruction with the specified interface according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface includes:
comparing the IP address of the opposite terminal equipment connected with other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned;
and if the VPN identification is different from the specific interface, binding the VPN identification carried by the configuration instruction with the specific interface.
With reference to the first aspect, in a third possible implementation manner, creating a socket address structure including at least a VPN index includes:
acquiring a VPN index recorded in a Redis client;
a socket address structure is created and the obtained VPN index is added to a specified location of the socket address structure.
With reference to the first aspect, in a fourth possible implementation manner, establishing a TCP connection belonging to a VPN between a Redis client and a specified Redis server according to a VPN index in a socket address structure includes:
and interacting the designated Redis server side for TCP connection through the designated interface bound with the VPN identifier so as to establish TCP connection between the designated interface of the Redis client side and the designated Redis server side, wherein the TCP connection belongs to the VPN corresponding to the VPN identifier.
In a second aspect, the present application provides a connection establishment apparatus, which is applied to a Redis client, and includes:
the socket module is used for creating a socket address structure at least comprising a VPN index, the socket address structure corresponds to a created socket, the socket is associated with TCP connection to be established between a Redis client and a specified Redis server, the VPN index is an index of a VPN identifier bound with a specified interface on the Redis client, and the specified interface is an interface connected with the specified Redis server on the Redis client;
and the TCP connection module is used for establishing TCP connection belonging to the VPN corresponding to the VPN identifier between the Redis client and the appointed Redis server according to the VPN index in the socket address structure.
With reference to the first aspect, in a first possible implementation manner, the apparatus further includes:
the VPN module is used for receiving a configuration instruction before the socket module creates a socket address structure, wherein the configuration instruction is used for indicating that a VPN identifier is bound to a specified interface and carries the VPN identifier to be bound with the specified interface;
checking whether the VPN identification carried by the configuration instruction is the same as the VPN identification bound by other interfaces except the specified interface on the Redis client;
if not, binding the VPN identification carried by the configuration instruction with the specified interface;
if yes, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with other interfaces and the IP address of the specified Redis server connected with the specified interface.
With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner, the determining, by the VPN module, whether to bind the VPN identifier carried by the configuration instruction with the specified interface according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface includes:
comparing the IP address of the opposite terminal equipment connected with other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned;
and if the VPN identification is different from the specific interface, binding the VPN identification carried by the configuration instruction with the specific interface.
With reference to the second aspect, in a third possible implementation manner, the creating, by a socket module, a socket address structure including at least a VPN index includes:
acquiring a VPN index recorded in a Redis client;
a socket address structure is created and the obtained VPN index is added to a specified location of the socket address structure.
With reference to the second aspect, in a fourth possible implementation manner, the establishing, by the TCP connection module, a TCP connection belonging to a VPN between the Redis client and the specified Redis server according to a VPN index in the socket address structure includes:
and interacting the designated Redis server side for TCP connection through the designated interface bound with the VPN identifier so as to establish TCP connection between the designated interface of the Redis client side and the designated Redis server side, wherein the TCP connection belongs to the VPN corresponding to the VPN identifier.
In a third aspect, the present application provides an electronic device, comprising: a machine-readable storage medium and a processor, the machine-readable storage medium: storing instruction code, the processor: the connection establishment method is realized by communicating with a machine-readable storage medium, reading and executing instruction codes in the machine-readable storage medium.
In a fourth aspect, the present application provides a machine-readable storage medium having stored thereon computer instructions which, when executed, perform the above-mentioned connection establishment method.
According to the technical scheme, the specific interface of the Redis client connected with the specific Redis server is bound with the VPN identifier, the specified interface bound with the VPN identifier is used for establishing TCP connection with the specific Redis server, and then the VPN is used for distinguishing different Redis servers with the same specific IP address. Therefore, under the scene that the same Redis client is simultaneously connected with at least two different Redis servers (the IP addresses are the same), as long as the VPN identifications bound to the ports connected with the different Redis servers on the Redis client are different, the Redis client can distinguish the different Redis servers through the VPN identifications, and TCP connection is successfully established with the different Redis servers with the same IP addresses.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a diagram of a Redis client and a Redis server networking application;
FIG. 2 is a flow chart of a method provided by an embodiment of the present application;
fig. 3 is a flowchart of binding a VPN index and a specific interface according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an application provided by an embodiment of the present application;
FIG. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present disclosure;
fig. 6 is a schematic hardware structure diagram of the apparatus shown in fig. 5 according to an embodiment of the present disclosure.
Detailed Description
At present, a TCP connection is established between a Redis client and a Redis server through a public VPN. This TCP connection establishment method restricts that, on the premise that the Redis server 1020 and the Redis server 1021 shown in fig. 1 have the same IP address, the Redis client 1011 cannot successfully establish TCP connection with the Redis server 1020 and the Redis server 1021 because the Redis server 1020 and the Redis server 1021 cannot be distinguished.
In order to solve the above problem, on the premise that the same Redis client is simultaneously connected to at least two different Redis servers with the same IP address, the Redis client can also successfully establish a TCP connection with each different Redis server with the same IP address, and the embodiment of the present application provides a flow shown in fig. 2:
referring to fig. 2, fig. 2 is a flowchart of a method provided by an embodiment of the present application. The flow is applied to the Redis client.
As shown in fig. 2, the process includes the following steps:
step 201, a socket address structure is created that includes at least a VPN index.
As an embodiment, when a TCP connection between a Redis client and a specified Redis server (any one of the Redis servers) is established, the Redis client may first call a Socket function to create a Socket. The socket is based on an interface and an IP address, wherein the interface is an interface (marked as a designated interface) which is used for establishing TCP connection with a designated Redis server on a Redis client, and the IP address is the IP address of the designated Redis server.
After a Socket is successfully created, the Socket function returns a Socket descriptor. The socket descriptor is used herein to uniquely describe the above-created socket.
At the same time, the Redis client creates a socket address structure. The socket address structure here is associated with (called corresponds to) the above-described created socket. In the embodiment of the application, the method for creating the socket address structure by the Redis client is similar to the existing method for creating the socket address structure, but the content contained in the finally created socket address structure is changed compared with the existing socket address structure.
In one example, the above change is: the VPN index is additionally added in the created socket address structure. At this time, in the embodiment of the present application, the socket address structure created by the Redis client still inherits the requirements (parameters to be specifically included) of the existing socket address structure.
In another example, the above change is: at least a VPN index is included in the created socket address structure. At this time, the socket address structure created in the embodiment of the present application may not inherit or partially inherit the requirement (parameter to be included) of the existing socket address structure, and the embodiment of the present application is not particularly limited.
As an embodiment, the VPN index is an index of a VPN identifier bound to the specific interface. In one example, the VPN index is recorded in code on the Redis client before creating the socket address structure. Based on this, creating a socket address structure including at least the VPN index in step 201 includes:
acquiring a VPN index recorded in a Redis client;
a socket address structure is created and the obtained VPN index is added to a specified location of the socket address structure. Here, the designated location may be the last free location in the socket address structure. It is finally achieved how to create a socket address structure comprising at least a VPN index.
Step 202, according to the VPN index in the socket address structure, a TCP connection belonging to the VPN corresponding to the VPN identifier is established between the Redis client and the specified Redis server.
In one example, the VPN identification corresponds to the VPN index described above.
In one example, step 202 may be implemented by the following step a:
step a, interacting with a specified Redis server for TCP connection through the specified interface bound with the VPN identification so as to establish TCP connection between the specified interface of the Redis client and the specified Redis server, wherein the TCP connection belongs to the VPN corresponding to the VPN identification.
As an embodiment, the above-mentioned interaction for TCP connection with the specified Redis server is, for example, three-way handshake of TCP.
Thus, the flow shown in fig. 2 is completed.
As can be seen from the flow shown in fig. 2, in the embodiment of the present application, a VPN identifier is bound to a specific interface connecting a specific Redis server to a Redis client, a TCP connection is established between the specific interface binding the VPN identifier and the specific Redis server, and then a VPN is used to distinguish different Redis servers having a specific same IP address. Therefore, under the scene that the same Redis client is simultaneously connected with at least two different Redis servers (the IP addresses are the same), as long as the VPN identifications bound to the ports connected with the different Redis servers on the Redis client are different, the Redis client can distinguish the different Redis servers through the VPN identifications, and TCP connection is successfully established with the different Redis servers with the same IP addresses.
Optionally, in one embodiment, prior to the flow shown in fig. 2, the Redis client may create a VPN identifier and bind the VPN identifier with the specified interface.
As an embodiment, the binding of the VPN identifier with the specified interface by the Redis client may be implemented by the flow illustrated in fig. 3. As shown in fig. 3, the process may include:
step 301, the Redis client receives a configuration instruction, where the configuration instruction is used to indicate that a VPN identifier is bound for a specified interface, and the configuration instruction carries the VPN identifier to be bound with the specified interface.
When binding the VPN identification for the designated interface, determining which VPN identification needs to be bound with the designated interface according to actual requirements. Once the VPN identifier is determined, the determined VPN identifier is carried in a configuration instruction and sent to the Redis client.
Step 302, the Redis client checks whether the VPN identification carried by the configuration instruction is the same as the VPN identification bound to other interfaces except the specified interface on the Redis client, and if not, the VPN corresponding to the VPN identification is bound to the specified interface; if yes, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with other interfaces and the IP address of the specified Redis server connected with the specified interface.
As an embodiment, the determining, in this step 302, whether to bind the VPN identifier carried by the configuration instruction with the specified interface according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface may include:
comparing the IP address of the opposite terminal equipment connected with other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned; here, as an embodiment, the binding failure message may be used to indicate that the configuration command is re-issued to re-bind the VPN identifier for the specified interface.
And if the VPN identification is different from the specific interface, binding the VPN identification carried by the configuration instruction with the specific interface.
Through the steps, on the premise that the same Redis client is simultaneously connected with at least two different Redis servers (the IP addresses are the same), different Redis servers are distinguished through different VPN identifications bound by ports connected with the different Redis servers on the Redis client, so that the Redis client can be ensured to successfully establish TCP connection with the different Redis servers with the same IP addresses.
It should be noted that, in the embodiment of the present application, when the VPN identifier is bound for a specific interface, the Redis client may further generate a corresponding VPN index. The VPN index generated here may be set depending on the order of the received configuration commands, for example, if the order of the currently received configuration commands is 10, then the VPN index is 10.
The flow shown in fig. 3 is completed.
Through the flow shown in fig. 3, how to bind the VPN identifier for the specified interface is finally achieved.
Based on the flows shown in fig. 2 and fig. 3, the following description is made by a specific embodiment:
referring to fig. 4, fig. 4 is an application schematic diagram provided in the present embodiment. As shown in fig. 4, the Redis client 401 is connected to the Redis server 402 through an interface eth12 and to the Redis server 403 through an interface eth 13. In fig. 4, the IP addresses of the Redis server 402 and the Redis server 403 are the same, and both are 192.168.5.12. The IP address of the Redis client 401 is 192.168.5.11.
In fig. 4, based on the flow shown in fig. 3, finally, the interface eth12 of the Redis client 401 is bound to the VPN41, and the interface eth13 of the Redis client 401 is bound to the VPN 42.
In fig. 4, since the interface eth12 of the Redis client 401 is bound to the VPN41, this means that the Redis server 402 connected to the interface eth12 of the Redis client 401 is based on the VPN41, and therefore, when the Redis client 401 establishes a TCP connection with the Redis server 402, the connection can be established based on the VPN 41. Based on the flow shown in fig. 2, the Redis client 401 will eventually establish a TCP connection in the VPN41 with the Redis server 402.
Also, since the interface eth13 of the Redis client 401 is bound to the VPN42, this means that the Redis server 403 to which the interface eth13 of the Redis client 401 is connected is based on the VPN42, and thus, may be established based on the VPN42 when the Redis client 401 establishes a TCP connection with the Redis server 403. Based on the flow shown in fig. 2, the Redis client 401 will eventually establish a TCP connection in the VPN42 with the Redis server 403.
Finally, even if the Redis server 402 and the Redis server 403 have the same IP address, the Redis client 401 can distinguish the Redis server 402 and the Redis server 403 through the VPN41 and the VPN42, and can establish TCP connections belonging to different VPNs with the Redis server 402 and the Redis server 403 respectively.
The description of the embodiment shown in fig. 4 is thus completed.
The methods provided herein are described above. The following describes the apparatus provided in the present application:
referring to fig. 5, fig. 5 is a structural diagram of the apparatus according to the present embodiment. As shown in fig. 5, the apparatus may include:
the socket module is used for creating a socket address structure at least comprising a VPN index, the socket address structure corresponds to a created socket, the socket is associated with TCP connection to be established between a Redis client and a specified Redis server, the VPN index is an index of a VPN identifier bound with a specified interface on the Redis client, and the specified interface is an interface connected with the specified Redis server on the Redis client;
and the TCP connection module is used for establishing TCP connection belonging to the VPN corresponding to the VPN identifier between the Redis client and the appointed Redis server according to the VPN index in the socket address structure.
In one example, as shown in fig. 5, the apparatus further comprises:
the VPN module is used for receiving a configuration instruction before the socket module creates a socket address structure, wherein the configuration instruction is used for indicating that a VPN identifier is bound to a specified interface and carries the VPN identifier to be bound with the specified interface;
checking whether the VPN identification carried by the configuration instruction is the same as the VPN identification bound by other interfaces except the specified interface on the Redis client;
if not, binding the VPN identification carried by the configuration instruction with the specified interface;
if yes, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with other interfaces and the IP address of the specified Redis server connected with the specified interface.
As an embodiment, the determining, by the VPN module, whether to bind the VPN identifier carried by the configuration instruction with the specified interface according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface includes:
comparing the IP address of the opposite terminal equipment connected with other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned;
and if the VPN identification is different from the specific interface, binding the VPN identification carried by the configuration instruction with the specific interface.
For one embodiment, the socket module creates a socket address structure including at least a VPN index, comprising:
acquiring a VPN index recorded in a Redis client;
a socket address structure is created and the obtained VPN index is added to a specified location of the socket address structure.
As an embodiment, the TCP connection module establishes, according to the VPN index in the socket address structure, a TCP connection belonging to the VPN corresponding to the VPN identifier between the Redis client and the specified Redis server, and includes:
and interacting the designated Redis server side for TCP connection through the designated interface bound with the VPN identifier so as to establish TCP connection between the designated interface of the Redis client side and the designated Redis server side, wherein the TCP connection belongs to the VPN corresponding to the VPN identifier.
Thus, the description of the structure of the apparatus shown in fig. 5 is completed.
Correspondingly, the application also provides a hardware structure diagram of the device shown in fig. 5. As shown in fig. 6, the hardware structure may include: a machine-readable storage medium and a processor, wherein:
a machine-readable storage medium: the instruction code is stored.
A processor: the TCP connection establishment method disclosed by the embodiment is realized by communicating with a machine-readable storage medium, reading and executing instruction codes in the machine-readable storage medium.
Thus, the hardware configuration of the apparatus shown in fig. 6 is completed.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (8)

1. A connection establishing method is applied to a Redis client and comprises the following steps:
creating a socket address structure at least comprising a VPN index, wherein the socket address structure corresponds to a created socket, the socket is associated with a TCP connection to be established between the Redis client and a specified Redis server, the VPN index is an index of a VPN identifier bound with a specified interface on the Redis client, and the specified interface is an interface connected with the specified Redis server on the Redis client;
and interacting the designated Redis server side for TCP connection through the designated interface bound with the VPN identifier so as to establish TCP connection between the designated interface of the Redis client side and the designated Redis server side, wherein the TCP connection belongs to the VPN corresponding to the VPN identifier.
2. The method of claim 1, wherein prior to said creating said socket address structure, said method further comprises:
receiving a configuration instruction, wherein the configuration instruction is used for indicating that a VPN identifier is bound to the specified interface, and the configuration instruction carries the VPN identifier to be bound with the specified interface;
checking whether the VPN identification carried by the configuration instruction is the same as the VPN identifications bound to other interfaces except the specified interface on the Redis client;
if not, binding the VPN identification carried by the configuration instruction with the specified interface;
if so, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with the other interfaces and the IP address of the specified Redis server connected with the specified interface.
3. The method according to claim 2, wherein the determining, according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface, whether to bind the VPN identifier carried by the configuration instruction with the specified interface includes:
comparing the IP address of the opposite terminal equipment connected with the other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned;
and if the VPN identification carried by the configuration instruction is different from the designated interface, binding the VPN identification carried by the configuration instruction with the designated interface.
4. The method of claim 1, wherein creating a socket address structure including at least a VPN index comprises:
acquiring the VPN index recorded in the Redis client;
and creating a socket address structure, and adding the acquired VPN index to a specified position of the socket address structure.
5. A connection establishing apparatus, applied to a Redis client, comprising:
the socket module is used for creating a socket address structure at least comprising a VPN index, wherein the socket address structure corresponds to a created socket, the socket is associated with a TCP connection to be established between the Redis client and a specified Redis server, the VPN index is an index of a VPN identifier bound with a specified interface on the Redis client, and the specified interface is an interface connected with the specified Redis server on the Redis client;
and the TCP connection module is used for interacting with the specified Redis server side for TCP connection through the specified interface bound with the VPN identifier so as to establish TCP connection between the specified interface of the Redis client side and the specified Redis server side, wherein the TCP connection belongs to the VPN corresponding to the VPN identifier.
6. The apparatus of claim 5, further comprising:
a VPN module, configured to receive a configuration instruction before the socket module creates the socket address structure, where the configuration instruction is used to instruct to bind a VPN identifier to the designated interface, and the configuration instruction carries a VPN identifier to be bound to the designated interface;
checking whether the VPN identification carried by the configuration instruction is the same as the VPN identifications bound to other interfaces except the specified interface on the Redis client;
if not, binding the VPN identification carried by the configuration instruction with the specified interface;
if so, judging whether to bind the VPN identification carried by the configuration instruction with the specified interface according to the IP address of the opposite terminal device connected with the other interfaces and the IP address of the specified Redis server connected with the specified interface.
7. The apparatus according to claim 6, wherein the determining, by the VPN module, whether to bind the VPN identifier carried by the configuration instruction with the specified interface according to the IP address of the peer device connected to the other interface and the IP address of the specified Redis server connected to the specified interface includes:
comparing the IP address of the opposite terminal equipment connected with the other interfaces with the IP address of the appointed Redis server connected with the appointed interface;
if the VPN identification carried by the configuration instruction is the same as the specified interface, the VPN identification carried by the configuration instruction is forbidden to be bound with the specified interface, and a binding failure message is returned;
and if the VPN identification carried by the configuration instruction is different from the designated interface, binding the VPN identification carried by the configuration instruction with the designated interface.
8. The apparatus of claim 5, wherein the socket module creates a socket address structure including at least a VPN index, comprising:
acquiring the VPN index recorded in the Redis client;
and creating a socket address structure, and adding the acquired VPN index to a specified position of the socket address structure.
CN201910226248.2A 2019-03-25 2019-03-25 Connection establishment method and device Active CN109981640B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910226248.2A CN109981640B (en) 2019-03-25 2019-03-25 Connection establishment method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910226248.2A CN109981640B (en) 2019-03-25 2019-03-25 Connection establishment method and device

Publications (2)

Publication Number Publication Date
CN109981640A CN109981640A (en) 2019-07-05
CN109981640B true CN109981640B (en) 2021-07-23

Family

ID=67080270

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910226248.2A Active CN109981640B (en) 2019-03-25 2019-03-25 Connection establishment method and device

Country Status (1)

Country Link
CN (1) CN109981640B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101543004A (en) * 2006-11-20 2009-09-23 英国电讯有限公司 Secure network architecture
CN101599901A (en) * 2009-07-15 2009-12-09 杭州华三通信技术有限公司 The method of remotely accessing MPLS VPN, system and gateway
CN106686056A (en) * 2016-11-25 2017-05-17 济南中维世纪科技有限公司 Android client communication device and method allowing Android client communication device to connect and communicate with server
CN106888145A (en) * 2017-03-17 2017-06-23 新华三技术有限公司 A kind of VPN resource access methods and device
CN108881487A (en) * 2018-08-01 2018-11-23 安克创新科技股份有限公司 The control method and its server and electronic equipment of terminal device base station
CN108880885A (en) * 2018-06-19 2018-11-23 杭州迪普科技股份有限公司 A kind of message processing method and device
CN109005150A (en) * 2018-06-11 2018-12-14 烽火通信科技股份有限公司 Based on ethernet mac address without linking communications method and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10178181B2 (en) * 2014-04-02 2019-01-08 Cisco Technology, Inc. Interposer with security assistant key escrow

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101543004A (en) * 2006-11-20 2009-09-23 英国电讯有限公司 Secure network architecture
CN101599901A (en) * 2009-07-15 2009-12-09 杭州华三通信技术有限公司 The method of remotely accessing MPLS VPN, system and gateway
CN106686056A (en) * 2016-11-25 2017-05-17 济南中维世纪科技有限公司 Android client communication device and method allowing Android client communication device to connect and communicate with server
CN106888145A (en) * 2017-03-17 2017-06-23 新华三技术有限公司 A kind of VPN resource access methods and device
CN109005150A (en) * 2018-06-11 2018-12-14 烽火通信科技股份有限公司 Based on ethernet mac address without linking communications method and system
CN108880885A (en) * 2018-06-19 2018-11-23 杭州迪普科技股份有限公司 A kind of message processing method and device
CN108881487A (en) * 2018-08-01 2018-11-23 安克创新科技股份有限公司 The control method and its server and electronic equipment of terminal device base station

Also Published As

Publication number Publication date
CN109981640A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
CN102035904B (en) Method for converting TCP network communication server into client
CN106850324B (en) Virtual network interface object
CN109284140B (en) Configuration method and related equipment
CN111385180B (en) Communication tunnel construction method, device, equipment and medium
US20170034311A1 (en) Method for selecting between multiple RPC frameworks during a TCP/IP session
CN111181992B (en) Communication method, device, equipment and storage medium of nodes and chain codes in block chain
CN111147340A (en) Method, equipment and medium for carrying out networked access on CAN bus interface
CN113220484A (en) Micro-service calling method and device, electronic equipment and storage medium
CN111405059B (en) Cloud device data transmission method, electronic device and Internet of things system
CN105518693B (en) A kind of safety protecting method and device
CN114157639B (en) Method, device and equipment for collecting information of intelligent network card of server and readable medium
CN111817878A (en) Networking method and device of intelligent equipment and cloud server
CN107734046A (en) Method, service end, client and the system of remote operation database
CN113572761B (en) Equipment identification method and device, electronic equipment and storage medium
CN109981640B (en) Connection establishment method and device
CN108804711A (en) A kind of method, apparatus and computer readable storage medium of data processing
CN103560918A (en) Method and system for managing CPE port
CN111935260B (en) Account synchronization method and device, electronic equipment and storage medium
CN107018140B (en) Authority control method and system
CN107071040B (en) Authority control method and system based on file descriptor and session
US7805733B2 (en) Software implementation of hardware platform interface
CN112954658B (en) Business card system suitable for data exchange of communication protocol layer and data exchange method
CN114238927A (en) Business system login method, system, device, computer equipment and storage medium
CN114338461A (en) Network connection monitoring method and related equipment
US20040230830A1 (en) Receiver, connection controller, transmitter, method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant