CN109729000B - Instant messaging method and device - Google Patents

Instant messaging method and device Download PDF

Info

Publication number
CN109729000B
CN109729000B CN201811541568.9A CN201811541568A CN109729000B CN 109729000 B CN109729000 B CN 109729000B CN 201811541568 A CN201811541568 A CN 201811541568A CN 109729000 B CN109729000 B CN 109729000B
Authority
CN
China
Prior art keywords
server
network environment
packet information
authentication
information
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
CN201811541568.9A
Other languages
Chinese (zh)
Other versions
CN109729000A (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.)
Beijing IQIYI Science and Technology Co Ltd
Original Assignee
Beijing IQIYI Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing IQIYI Science and Technology Co Ltd filed Critical Beijing IQIYI Science and Technology Co Ltd
Priority to CN201811541568.9A priority Critical patent/CN109729000B/en
Publication of CN109729000A publication Critical patent/CN109729000A/en
Application granted granted Critical
Publication of CN109729000B publication Critical patent/CN109729000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The embodiment of the invention provides an instant messaging method and an instant messaging device, which are applied to a client side communicating with a server, and the method comprises the following steps: judging whether the current network environment is a weak network environment or not by judging whether the current network environment is the weak network environment or not; if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information; sending IM instant information and simplified authentication packet information to a server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network. Compared with the prior art, the embodiment of the invention sends the IM with the data volume less than the maximum transmission unit of the network and the simplified authentication packet information to the server after judging that the current network is in a weak network environment, thereby avoiding the loss of the information packet caused by unpacking and improving the success rate of the instant communication between the client and the server.

Description

Instant messaging method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to an instant messaging method and an instant messaging device.
Background
The development of instant messaging provides great convenience for the life of people, and people can acquire the latest information of the network through the server in real time by utilizing the client so as to meet the requirements of users.
When the client communicates with the server instantly, after establishing a TCP link with the server, the client sends authentication packet information to the server, and finally sends Instant Messaging (IM) information. Because the data volume of the authentication packet information and the IM instant message is large, the client needs to split the authentication packet information into a plurality of packets, then compress and encode the IM instant message and the split packets, and send the packets to the server, so that the packets of the authentication packet information or the IM packets are often lost in the process of sending the packets to the server under the condition that the network environment depending on the instant communication between the client and the server is poor, and the transmission of the IM instant message often fails. Therefore, in the weak network environment, the success rate of instant messaging between the client and the server is low.
Disclosure of Invention
The embodiment of the invention aims to provide an instant messaging method and an instant messaging device. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides an instant messaging method, which is applied to a client communicating with a server, and includes:
Judging whether the current network environment is a weak network environment or not;
if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information; the authentication packet information is encoded and compressed authentication packet information;
sending instant message IM and simplified authentication packet information to a server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
Optionally, sending the instant message IM and the simplified authentication packet information to the server includes:
sending instant message IM and simplified authentication packet information to a weak network port of a server; the weak network port is a port which is newly added by the server and is used for receiving information in the weak network environment.
Optionally, before determining whether the current network environment is a weak network environment, an instant messaging method provided in an embodiment of the first aspect of the present invention further includes:
and establishing a Transmission Control Protocol (TCP) network connection with the server.
Optionally, the determining whether the current network environment is a weak network environment includes:
if the failure times of sending the authentication packet information to the server under the current network environment exceed the time threshold, judging that the current network environment is a weak network environment;
Or, if the information returned by the server is not received within the preset time after the heartbeat packet information is sent to the server in the current network environment, the current network environment is judged to be the weak network environment.
Optionally, if the current network environment is a weak network environment, the authentication packet information is simplified to obtain simplified authentication packet information, including:
if the current network environment is a weak network environment, deleting the non-authentication identification information in the authentication packet information and reserving the authentication identification information, and taking the deleted authentication packet information as simplified authentication packet information; the authentication identification information is used for unique identification for authentication with the server.
Optionally, the non-authentication identification information includes: statistical information and wind control information; the authentication identification information includes: a user identifier and authentication information.
Optionally, before the step of sending the instant message IM and the simplified authentication packet message to the server, the embodiment of the present invention provides an instant messaging method further including: the instant message IM is encrypted.
Optionally, sending the instant message IM and the simplified authentication packet information to the server includes:
and sending the encrypted IM and the simplified authentication packet information to a server.
Optionally, if the current network environment is a weak network environment, the instant messaging method provided in the embodiment of the first aspect of the present invention further includes:
changing the waiting time;
according to the changed waiting time, the receiving server returns a message receipt aiming at the IM; the changed waiting time is longer than the original waiting time.
In a second aspect, an embodiment of the present invention provides an instant messaging method, which is applied to a server in communication with a client, where the server includes: the method comprises the following steps that a port and a non-weak network port which are newly added and used for receiving information under the weak network environment are added:
receiving instant message IM and simplified authentication packet information sent by a client through a weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or, receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
Optionally, before receiving the instant message IM and the simplified authentication packet information sent by the client through the weak network port, an embodiment provided in the second aspect of the present invention further includes:
And establishing a Transmission Control Protocol (TCP) network connection with the client.
Optionally, if the received IM is an encrypted IM, after the processor receives the instant message IM and the simplified authentication packet information sent by the client through the weak network port, the embodiment provided in the second aspect of the present invention further includes:
the IM is decrypted.
In a third aspect, an embodiment of the present invention provides an instant messaging device, applied to a client communicating with a server, where the instant messaging device includes:
the judging module is used for judging whether the current network environment is a weak network environment or not;
the simplifying module is used for simplifying the authentication packet information to obtain simplified authentication packet information if the current network environment is a weak network environment;
the weak network sending module is used for sending the instant message IM and the simplified authentication packet information to the server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
Optionally, the weak network sending module is specifically configured to:
sending instant message IM and simplified authentication packet information to a weak network port of a server; the weak network port is a port which is newly added by the server and is distinguished from a non-weak network port.
An embodiment of the third aspect of the present invention provides an instant messaging device, further including:
And the network connection module is used for establishing Transmission Control Protocol (TCP) network connection with the server.
Optionally, the determining module is specifically configured to:
if the failure times of sending the authentication packet information to the server under the current network environment exceed the time threshold, judging that the current network environment is a weak network environment;
or, if the information returned by the server is not received within the preset time after the heartbeat packet information is sent to the server in the current network environment, the current network environment is judged to be the weak network environment.
Optionally, the simplified module is specifically configured to:
if the current network environment is a weak network environment, deleting the non-authentication identification information in the authentication packet information and reserving the authentication identification information, and taking the deleted authentication packet information as simplified authentication packet information; the authentication identification information is used for unique identification for authentication with the server.
Optionally, an instant messaging device provided in an embodiment of the third aspect of the present invention further includes:
the encryption module is used for encrypting the IM;
optionally, the weak network sending module is specifically configured to: and sending the encrypted IM and the simplified authentication packet information to a server.
An embodiment of the third aspect of the present invention provides an instant messaging device, further including:
The receipt receiving module is used for changing the waiting time if the current network environment is the weak network environment; according to the changed waiting time, the receiving server returns a message receipt aiming at the IM; the changed waiting time is longer than the original waiting time.
In a fourth aspect, an embodiment of the present invention provides an instant messaging device, which is applied to a server in communication with a client, where the server includes: newly-increased port and the non-weak net port that is used for receiving information under the weak net environment, the device includes:
receiving instant message IM and simplified authentication packet information sent by a client through a weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or, receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
An embodiment of a fourth aspect of the present invention provides an instant messaging device, further including:
and the network connection module is used for establishing Transmission Control Protocol (TCP) network connection with the client.
An embodiment of a fourth aspect of the present invention provides an instant messaging device, further including:
and the decryption module is used for decrypting the IM.
In a fifth aspect, an embodiment of the present invention provides a terminal device, where the terminal device includes: the terminal equipment further comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory finish mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is configured to implement the method steps of the first aspect when executing the program stored in the memory.
In a sixth aspect, an embodiment of the present invention provides a server, including a processor, a communication interface, a memory, and a communication bus, where the communication interface at least includes: a weak network port and a non-weak network port; the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is used for realizing the following method steps when executing the program stored in the memory:
Receiving instant message IM and simplified authentication packet information sent by a client through the weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or the like, or, alternatively,
and receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
Optionally, before receiving, through the weak network port, the instant message IM and the simplified authentication packet information sent by the client, the server according to the sixth aspect of the present invention is further configured to:
and establishing a Transmission Control Protocol (TCP) network connection with the client.
Optionally, if the received IM is an encrypted IM, after the processor receives the instant message IM and the simplified authentication packet information sent by the client through the weak network port, the server provided in the sixth aspect of the present invention is further configured to:
decrypting the IM.
In a seventh aspect, the present invention provides a computer-readable storage medium having stored therein instructions, which, when executed on a computer, cause the computer to perform the method of any of the first or second aspects.
In an eighth aspect, embodiments of the present application provide an application program, which when run on a computer, causes the computer to perform any one of the methods of the first aspect or the second aspect.
In a ninth aspect, the present invention also provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any of the first or second aspects described above.
The instant messaging method and the instant messaging device provided by the embodiment of the invention are applied to a client end communicating with a server, and whether the current network environment is the weak network environment is judged by judging whether the current network environment is the weak network environment; if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information; the authentication packet information is encoded and compressed authentication packet information; sending IM instant information and simplified authentication packet information to a server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network. Compared with the prior art, the embodiment of the invention sends the IM with the data volume less than the maximum transmission unit of the network and the simplified authentication packet information to the server after judging that the current network is in a weak network environment, thereby avoiding the loss of the information packet caused by unpacking and improving the success rate of the instant communication between the client and the server.
The communication method and the device provided by the embodiment of the invention are applied to a server which is communicated with a client, and receive instant information IM and simplified authentication package information which are sent by the client through a weak network port, wherein the total data volume of the IM and the simplified authentication package information is less than the data volume of the maximum transmission unit of a network; or, receiving the authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result. Compared with the prior art that the server receives the IM and the authentication packet information of the client through the non-weak network port under the conditions of the weak network and the non-weak network, the embodiment of the invention adds the weak network port for receiving the IM and the simplified authentication packet information under the condition of the weak network, and does not need to distinguish the information sent by the client under the conditions of the non-weak network and the weak network again after the server receives the information sent by the client through the non-weak network port, thereby avoiding the error of the server in distinguishing the information sent by the client under the conditions of the non-weak network and the weak network, improving the success rate of instant communication between the client and the server and simultaneously improving the efficiency of the server in receiving the information. It is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of an instant messaging method according to a first aspect of the present invention;
FIG. 2 is a flowchart illustrating client-server interaction in a weak network environment according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating client-server interaction in a non-weakly networked environment according to an embodiment of the present invention;
fig. 4 is a structural diagram of an instant messaging device according to a third aspect of the present invention;
fig. 5 is a structural diagram of a terminal device according to an embodiment of the present invention;
fig. 6 is a block diagram of a server according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention.
The instant messaging method and the instant messaging device provided by the embodiment of the invention are applied to a client end communicating with a server, and whether the current network environment is the weak network environment is judged by judging whether the current network environment is the weak network environment; if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information; sending IM instant information and simplified authentication packet information to a server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
First, a brief description is given to an instant messaging method provided by an embodiment of the present invention.
In a first aspect, in order to improve a success rate of instant messaging between a client and a server, from the perspective of a client communicating with a server, as shown in fig. 1, an embodiment of the present invention provides an instant messaging method, including:
s101, a client judges whether the current network environment is a weak network environment;
referring to fig. 2, before the step of S101, the server first needs to establish a TCP (Transmission Control Protocol) network connection with the client to test whether the current network environment can successfully send the simplified authentication packet information, and if the test fails, the step S101 does not need to be executed, so as to further improve the sending success rate of the instant message IM and the simplified authentication packet information in the weak network environment.
In order to improve the success rate of instant messaging between the client and the server, S101 may adopt at least one of the following possible implementation manners to determine whether the current network environment is a weak network environment:
in one possible implementation manner, if the number of times that the client fails to send the authentication packet information to the server under the current network environment exceeds a threshold number of times, the current network environment is determined to be the weak network environment. Wherein, the time threshold is a preset numerical value.
In another possible implementation manner, if the client does not receive information returned by the server within a predetermined time after sending the heartbeat packet information to the server in the current network environment, it is determined that the current network environment is a weak network environment. The preset time is a preset time value.
S102, if the current network environment is a weak network environment, the client simplifies the authentication packet information to obtain simplified authentication packet information;
in order to improve the success rate of instant messaging between the client and the server, S102 may adopt at least one possible implementation manner, where the client simplifies the authentication packet information:
in a possible implementation manner, if the current network environment is a weak network environment, the client decodes and decompresses the authentication packet information, then deletes the non-authentication identification information in the authentication packet information and retains the authentication identification information, and takes the deleted authentication packet information as the simplified authentication packet information. The authentication identification information is used for carrying out unique identification for authentication with the server; the authentication identification information may include, but is not limited to, a user identifier and authentication information.
The embodiment can ensure that the client and the server can carry out authentication certification through the simplified authentication information by simplifying the non-authentication identification information in the authentication packet information and reserving the authentication identification information, thereby improving the authentication certification rate of the client and the server.
In another possible implementation manner, if the current network environment is a weak network environment, the client decodes and decompresses the authentication packet information, deletes the statistical information and the wind control information in the authentication packet information, and uses the deleted authentication packet information as the simplified authentication packet information.
Wherein, the authentication package information includes: statistical information, wind control information, user identifiers and authentication information; the simplified authentication packet information includes: a user identifier and authentication information; the statistical information includes: a signal of the client, a brand of the client, a system installed in the client, a client ID, whether a client connection network is WIFI or a wired network, and the like; the wind control information includes: client ID of malicious access, number of malicious accesses, address of malicious access, etc.; authentication information may include, but is not limited to, Cookie information and tokens. The Cookie is data stored in the user local terminal by the web site for identifying the user identity and tracking the session. token represents an object of the right to perform an operation.
The embodiment simplifies the authentication packet information by deleting the statistical information and the wind control information in the authentication packet information, only retains the user identifier and the authentication information, and can quickly obtain the simplified authentication packet information.
In addition, in order to further reduce the data size of the authentication packet information, after the two embodiments, the simplified authentication packet information may be compressed and/or encoded again, so as to achieve the effect of further simplifying the authentication packet information.
S103, the client sends instant message IM and simplified authentication package information to the server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
Before the client sends the IM to the server, the client encrypts the IM so as to improve the safety of information transmission between the client and the server.
The client can encrypt by using a preset password; the client may also use a preset encryption algorithm. For example: one or more algorithms of MD5 (Message-Digest Algorithm 5), SHA1 (Secure Hash Algorithm), PBKDF2 (cipher-Based Key Derivation Function 2), AES (Advanced Encryption Standard), DEA (Data Encryption Algorithm), Hash Algorithm, and the like are combined to encrypt IM.
An encryption mode for encrypting the IM is agreed between the client and the server in advance, and if the client and the server agree to use a preset password for encryption, the server decrypts the IM by using the preset password. If the client encrypts the IM using the AES encryption algorithm, the server decrypts the IM using the AES encryption algorithm. Compared with the encryption by using a preset password, the IM is encrypted by using a preset algorithm with higher security.
After S103, after receiving the IM and the simplified authentication packet information sent by the client, the server decrypts the IM and then sends a message receipt aiming at the IM to the client; the message receipt is used by the server to notify the client IM whether the sending is successful, and may be: identification of future or false.
The server may decrypt the received IM using a preset password or a preset encryption algorithm.
The client changes the waiting time, and receives a message receipt returned by the server aiming at the IM according to the changed waiting time; the changed waiting time is larger than the original waiting time of the client. The original waiting time of the client is the time for the client to wait for the server to return the message receipt under the non-weak network environment.
If the client does not receive the message receipt sent by the server within the changed waiting time, the client fails to send the IM to the server, and if the client receives the message receipt sent by the server within the changed waiting time and the message receipt is the ture identifier, the client succeeds in sending the IM to the server. The client increases the waiting time, and the success rate of receiving the message receipt can be improved.
Compared with the prior art, the embodiment of the invention sends the IM with the data volume less than the maximum transmission unit of the network and the simplified authentication packet information to the server after judging that the current network is in a weak network environment, thereby avoiding the loss of the information packet caused by unpacking and improving the success rate of the instant communication between the client and the server.
In a first aspect of the embodiments of the present invention, an instant messaging method includes:
referring to fig. 3, if the current network environment is a non-weak network environment, the client sends authentication packet information to the server, receives an authentication result sent by the server according to the originally set waiting time, and after receiving the authentication result sent by the server, the client determines whether to send IM to the server based on the authentication result.
Specifically, the client may send authentication packet information to the non-weak network port of the server, and after receiving the authentication result sent by the server, the client determines whether to send the IM to the non-weak network port of the server based on the authentication result. At this time, after the server receives the authentication package information sent by the client through the non-weak network port of the server, the server directly performs authentication verification on the authentication package information, then sends an authentication verification result to the client, and receives the IM sent by the client.
Before the client sends the IM to the server, the client encrypts the IM so as to improve the safety of information transmission between the client and the server. The encryption method of the client in this embodiment is the same as that in the above embodiments, and will not be described again. At this time, the server decrypts the sent IM after receiving that the non-weak network port of the client sends itself receives the message receipt in the non-weak network environment, and then sends the message receipt to the client. The message receipt is used for informing the client whether IM is successfully sent or not by the server; the message receipt is as follows: identification of future or false.
In this embodiment, the client sends the authentication packet information to the server in the non-weak network environment, the server performs authentication verification on the authentication packet information sent by the client, and then sends the authentication verification result to the client, and the client sends the IM to the server based on the authentication verification result, so that the client and the server can perform instant messaging normally in the non-weak network environment, and the efficiency of performing instant messaging between the client and the server can be improved.
In a second aspect, in order to improve a success rate of instant messaging between a client and a server, from the perspective of the server communicating with the client, an embodiment of the present invention provides another instant messaging method, including:
Receiving instant message IM and simplified authentication packet information sent by a client through the weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or the like, or, alternatively,
and receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result. Referring to fig. 2, after the client sends the instant message IM and the simplified authentication packet information to the server, the server receives the instant message IM and the simplified authentication packet information sent by the client in the weak network environment.
Compared with the prior art that the server receives the IM and the authentication package information of the client through the non-weak network port under the conditions of the weak network and the non-weak network, the server side is preset with the weak network port, and the method and the device for receiving the IM and the simplified authentication package information sent by the client under the weak network environment can improve the efficiency of receiving the IM and the simplified authentication package information sent by the client under the weak network environment and improve the success rate of instant communication between the client and the server.
Before the server receives the instant message IM and the simplified authentication packet information sent by the client in the weak network environment through the weak network port, the server first needs to establish a transmission control protocol TCP network connection with the client to test whether the current network environment can successfully send the simplified authentication packet information, and if the test fails, the step S101 does not need to be executed, thereby further improving the sending success rate of the instant message IM and the simplified authentication packet information in the weak network environment.
Referring to fig. 3, the server receives, through its non-weak network port, authentication packet information sent in the non-weak network environment, performs authentication verification, then sends an authentication verification result to the client, and receives the IM sent by the client based on the authentication result.
And receiving the IM sent by the client based on the authentication result at the server, and decrypting the IM. An encryption mode for encrypting the IM is agreed between the client and the server in advance, and if the client and the server agree to use a preset password for encryption, the server decrypts the IM by using the preset password. If the client encrypts the IM using the AES encryption algorithm, the server decrypts the IM using the AES encryption algorithm.
After the server receives the IM sent by the client based on the authentication result, the server sends a message receipt aiming at the IM to the client; the client side changes the waiting time, and then receives a message receipt returned by the server for the IM according to the changed waiting time; and the changed waiting time is longer than the original waiting time, and the message receipt is used for informing the client whether the IM is successfully sent.
In a third aspect, in order to improve a success rate of instant messaging between a client and a server, as shown in fig. 4, an instant messaging device provided in an embodiment of the present invention is applied to a client communicating with a server, and includes:
a judging module 401, configured to judge whether a current network environment is a weak network environment;
a simplifying module 402, configured to simplify the authentication packet information if the current network environment is a weak network environment, to obtain simplified authentication packet information; the authentication packet information is encoded and compressed authentication packet information;
a weak network sending module 403, configured to send the instant message IM and the simplified authentication packet message to the server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
Optionally, the weak network sending module is specifically configured to:
sending instant message IM and simplified authentication packet information to a weak network port of a server; the weak network port is a port which is newly added by the server and is distinguished from a non-weak network port.
An embodiment of the third aspect of the present invention provides an instant messaging device, further including:
and the network connection module is used for establishing Transmission Control Protocol (TCP) network connection with the server.
The judgment module is specifically used for:
if the failure times of sending the authentication packet information to the server under the current network environment exceed the time threshold, judging that the current network environment is a weak network environment;
or, if the information returned by the server is not received within the preset time after the heartbeat packet information is sent to the server in the current network environment, the current network environment is judged to be the weak network environment.
Optionally, the simplified module is specifically configured to:
if the current network environment is a weak network environment, deleting the non-authentication identification information in the authentication packet information and reserving the authentication identification information, and taking the deleted authentication packet information as simplified authentication packet information; the authentication identification information is used for unique identification for authentication with the server.
An embodiment of the third aspect of the present invention provides an instant messaging device, further including:
the encryption module is used for encrypting the IM;
the weak network sending module is specifically configured to:
and sending the encrypted IM and the simplified authentication packet information to a server.
An embodiment of the third aspect of the present invention provides an instant messaging device, further including:
the receipt receiving module is used for changing the waiting time if the current network environment is the weak network environment; according to the changed waiting time, the receiving server returns a message receipt aiming at the IM; the changed waiting time is longer than the original waiting time.
In a fourth aspect, an embodiment of the present invention provides an instant messaging device, which is applied to a server in communication with a client, where the server includes: newly-increased port and the non-weak net port that is used for receiving information under the weak net environment, the device includes:
the receiving module is used for receiving instant messages IM and simplified authentication packet information sent by a client through a weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or the like, or, alternatively,
receiving authentication package information sent by a client through a non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
An embodiment of a fourth aspect of the present invention provides an instant messaging device, further including:
and the network connection module is used for establishing Transmission Control Protocol (TCP) network connection with the client.
An embodiment of a fourth aspect of the present invention provides an instant messaging device, further including:
and the decryption module is used for decrypting the IM.
In a fifth aspect, in order to improve the success rate of instant messaging between a client and a server, from the perspective of a client communicating with a server, an embodiment of the present invention provides a terminal device, as shown in fig. 5, further, the terminal device may be a mobile phone, a computer, a smart mobile terminal device, a wearable smart mobile terminal device, and the like, the terminal device includes a processor 501, a communication interface 502, a memory 503, and a communication bus 504, where the processor 501, the communication interface 502, and the memory 503 complete communication with each other through the communication bus 504,
A memory 503 for storing a computer program;
the processor 501, when executing the program stored in the memory 503, implements the following steps:
judging whether the current network environment is a weak network environment or not;
if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information;
sending instant message IM and simplified authentication packet information to a server; the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
In a sixth aspect, in order to improve the success rate of instant messaging between a client and a server, an embodiment of the present invention provides a server, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the communication interface 602 at least includes: the weak network port and the non-weak network port, the processor 601, the communication interface 602, and the memory 603 complete communication with each other through the communication bus 604,
a memory 603 for storing a computer program;
the processor 601 is configured to implement the following steps when executing the program stored in the memory 603:
receiving instant message IM and simplified authentication packet information sent by a client through the weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or the like, or, alternatively,
And receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
Corresponding to the method shown in the first aspect or the second aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of an instant messaging method as described above.
Corresponding to the method shown in the first aspect or the second aspect, an embodiment of the present invention provides a computer program product containing instructions, which when run on a computer, causes the computer to perform the steps of an instant messaging method as described above.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the apparatus/electronic device/computer-readable storage medium/computer program product embodiment/computer program, since it is substantially similar to the method embodiment, the description is relatively simple, and it suffices to refer to the partial description of the method embodiment in relation thereto.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (19)

1. An instant messaging method, applied to a client communicating with a server, the method comprising:
judging whether the current network environment is a weak network environment or not;
if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information; the authentication packet information before simplification is encoded and compressed authentication packet information;
sending instant message IM and the simplified authentication packet information to the server; and the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
2. The method as claimed in claim 1, wherein said sending instant message IM and said simplified authentication packet information to said server comprises:
sending instant message IM and the simplified authentication packet information to a weak network port of the server; and the weak network port is a port which is newly added by the server and is used for receiving information in the weak network environment.
3. The method of claim 1, wherein prior to determining whether the current network environment is a weak network environment, the method further comprises:
and establishing a Transmission Control Protocol (TCP) network connection with the server.
4. The method of claim 1, wherein determining whether the current network environment is a weak network environment comprises:
if the failure times of sending the authentication packet information to the server under the current network environment exceed the time threshold, judging that the current network environment is a weak network environment;
or, if the information returned by the server is not received within the preset time after the heartbeat packet information is sent to the server in the current network environment, determining that the current network environment is the weak network environment.
5. The method of claim 1, wherein if the current network environment is a weak network environment, simplifying the authentication packet information to obtain simplified authentication packet information comprises:
if the current network environment is a weak network environment, deleting the non-authentication identification information in the authentication packet information and reserving the authentication identification information, and taking the deleted authentication packet information as simplified authentication packet information; the authentication identification information is used for unique identification for authenticating with the server.
6. The method of claim 5, wherein the non-authentication identification information comprises: statistical information and wind control information; the authentication identification information includes: a user identifier and authentication information.
7. The method as claimed in claim 1, wherein before the step of sending the instant message IM and the simplified authentication package information to the server, the method further comprises:
encrypting the instant message IM;
the sending instant message IM and the simplified authentication packet information to the server includes:
and sending the encrypted IM and the simplified authentication packet information to the server.
8. The method according to any of claims 1 to 7, wherein if the current network environment is a weak network environment, the method further comprises:
changing the waiting time;
receiving a message receipt returned by the server aiming at the IM according to the changed waiting time; the changed waiting time is greater than the original waiting time.
9. An instant messaging apparatus, for use with a client in communication with a server, the apparatus comprising:
the judging module is used for judging whether the current network environment is a weak network environment or not;
The simplifying module is used for simplifying the authentication packet information to obtain simplified authentication packet information if the current network environment is a weak network environment; the authentication packet information before simplification is encoded and compressed authentication packet information;
the weak network sending module is used for sending instant message IM and the simplified authentication packet information to the server; and the total data volume of the IM and the simplified authentication packet information is less than the data volume of the maximum transmission unit of the network.
10. The apparatus of claim 9, wherein the weak network sending module is specifically configured to:
sending instant message IM and the simplified authentication packet information to a weak network port of the server; the weak network port is a port that is newly added by the server and is distinguished from a non-weak network port.
11. The apparatus of claim 9, further comprising:
and the network connection module is used for establishing Transmission Control Protocol (TCP) network connection with the server.
12. The apparatus according to claim 9, wherein the determining module is specifically configured to:
if the failure times of sending the authentication packet information to the server under the current network environment exceed the time threshold, judging that the current network environment is a weak network environment;
Or, if the information returned by the server is not received within the preset time after the heartbeat packet information is sent to the server in the current network environment, determining that the current network environment is the weak network environment.
13. The apparatus of claim 9, wherein the simplification module is specifically configured to:
if the current network environment is a weak network environment, deleting the non-authentication identification information in the authentication packet information and reserving the authentication identification information, and taking the deleted authentication packet information as simplified authentication packet information; the authentication identification information is used for unique identification for authenticating with the server.
14. The apparatus of claim 9, further comprising:
the encryption module is used for encrypting the IM;
the weak network sending module is specifically configured to:
and sending the encrypted IM and the simplified authentication packet information to the server.
15. The apparatus of any one of claims 9 to 14, further comprising:
the receipt receiving module is used for changing the waiting time if the current network environment is the weak network environment; receiving a message receipt returned by the server aiming at the IM according to the changed waiting time; the changed waiting time is greater than the original waiting time.
16. A server comprising a processor, a communication interface, a memory, and a communication bus, wherein the communication interface comprises at least: a weak network port and a non-weak network port; the processor, the communication interface and the memory complete mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor is used for realizing the following method steps when executing the program stored in the memory:
receiving instant message IM and simplified authentication packet information sent by a client through the weak network port, wherein the total data volume of the IM and the simplified authentication packet information is less than the data volume of a maximum transmission unit of a network; or the like, or, alternatively,
and receiving authentication package information sent by the client through the non-weak network port, performing authentication verification based on the received authentication package information, sending an authentication verification result to the client, and receiving instant message IM sent by the client based on the authentication verification result.
17. The server according to claim 16, wherein the processor, before receiving the instant message IM and the simplified authentication packet information sent by the client through the weak network port, is further configured to:
And establishing a Transmission Control Protocol (TCP) network connection with the client.
18. The server according to claim 16, wherein if the received IM is an encrypted IM, the processor, after receiving the IM sent by the client and the simplified authentication packet information through the weak network port, is further configured to:
decrypting the IM.
19. The terminal equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are used for completing mutual communication through the communication bus;
the memory is used for storing a computer program;
the processor, when executing the program stored in the memory, implementing the method steps of any of claims 1-8.
CN201811541568.9A 2018-12-17 2018-12-17 Instant messaging method and device Active CN109729000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811541568.9A CN109729000B (en) 2018-12-17 2018-12-17 Instant messaging method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811541568.9A CN109729000B (en) 2018-12-17 2018-12-17 Instant messaging method and device

Publications (2)

Publication Number Publication Date
CN109729000A CN109729000A (en) 2019-05-07
CN109729000B true CN109729000B (en) 2021-07-09

Family

ID=66296154

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811541568.9A Active CN109729000B (en) 2018-12-17 2018-12-17 Instant messaging method and device

Country Status (1)

Country Link
CN (1) CN109729000B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110958064A (en) * 2019-12-10 2020-04-03 英业达科技有限公司 Method for regulating data transmission
CN111314465B (en) * 2020-02-17 2023-04-07 天津卓朗科技发展有限公司 Weak network environment communication method and device and electronic equipment
CN115022390A (en) * 2022-05-27 2022-09-06 中国银行股份有限公司 Weak network-based service processing method, device, storage medium and program product
CN115021831B (en) * 2022-06-22 2024-03-12 北京有竹居网络技术有限公司 Weak network test method, device, system, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2479956A1 (en) * 2011-01-17 2012-07-25 Gemalto SA Method of optimizing a text massage communication between a server and a secure element
CN107147808A (en) * 2017-06-28 2017-09-08 珠海市魅族科技有限公司 A kind of message treatment method and device, computer installation and storage medium
CN107426080A (en) * 2017-03-20 2017-12-01 宇龙计算机通信科技(深圳)有限公司 Information forwarding method and device, electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100287244A1 (en) * 2009-05-11 2010-11-11 Navosha Corporation Data communication using disposable contact information

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2479956A1 (en) * 2011-01-17 2012-07-25 Gemalto SA Method of optimizing a text massage communication between a server and a secure element
CN107426080A (en) * 2017-03-20 2017-12-01 宇龙计算机通信科技(深圳)有限公司 Information forwarding method and device, electronic equipment
CN107147808A (en) * 2017-06-28 2017-09-08 珠海市魅族科技有限公司 A kind of message treatment method and device, computer installation and storage medium

Also Published As

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

Similar Documents

Publication Publication Date Title
CN108768970B (en) Binding method of intelligent equipment, identity authentication platform and storage medium
CN109729000B (en) Instant messaging method and device
US11451614B2 (en) Cloud authenticated offline file sharing
KR101508360B1 (en) Apparatus and method for transmitting data, and recording medium storing program for executing method of the same in computer
KR101361161B1 (en) System and method for reinforcing authentication using context information for mobile cloud
US9197420B2 (en) Using information in a digital certificate to authenticate a network of a wireless access point
CN108462710B (en) Authentication and authorization method, device, authentication server and machine-readable storage medium
CN102572815B (en) Method, system and device for processing terminal application request
CN100512201C (en) Method for dealing inserted-requested message of business in groups
CN108243176B (en) Data transmission method and device
CN102761870B (en) Terminal authentication and service authentication method, system and terminal
CN109688098B (en) Method, device and equipment for secure communication of data and computer readable storage medium
CN112989426B (en) Authorization authentication method and device, and resource access token acquisition method
CN111131300B (en) Communication method, terminal and server
CN104753674A (en) Application identity authentication method and device
CN111914291A (en) Message processing method, device, equipment and storage medium
CN112672342B (en) Data transmission method, device, equipment, system and storage medium
CN111404664A (en) Quantum secret communication identity authentication system and method based on secret sharing and multiple mobile devices
US10419212B2 (en) Methods, systems, apparatuses, and devices for securing network communications using multiple security protocols
CN104243452B (en) A kind of cloud computing access control method and system
CN105187369A (en) Data access method and data access device
CN112968910A (en) Replay attack prevention method and device
CN107819766A (en) Safety certifying method, system and computer-readable recording medium
CN112437046B (en) Communication method, system, electronic device and storage medium for preventing replay attack
CN115473655B (en) Terminal authentication method, device and storage medium for access network

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