[go: up one dir, main page]

CN103297321A - Communication method and system - Google Patents

Communication method and system Download PDF

Info

Publication number
CN103297321A
CN103297321A CN201310037232XA CN201310037232A CN103297321A CN 103297321 A CN103297321 A CN 103297321A CN 201310037232X A CN201310037232X A CN 201310037232XA CN 201310037232 A CN201310037232 A CN 201310037232A CN 103297321 A CN103297321 A CN 103297321A
Authority
CN
China
Prior art keywords
hsvr
hcode
message
address
guid
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.)
Pending
Application number
CN201310037232XA
Other languages
Chinese (zh)
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201310037232XA priority Critical patent/CN103297321A/en
Publication of CN103297321A publication Critical patent/CN103297321A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a communication method. Corresponding relation of an HCode and an HSvr is established, so that IUsr cross-domain communication is achieved. The invention further discloses a corresponding relation method for dynamically allocating HCode and SS connecting, and system maintaining cost is lowered. The invention further discloses an information exchanging method which makes the HSvr improve information exchanging efficiency. The invention further discloses a method for verifying the consistency of a source client side and a source IUsr, and a user client side is helped to achieve a dialing identifying function. The invention further discloses a cross-domain CC connecting establishing method which is used for achieving direct communication of the cross-domain IUsr. The invention further discloses a method for acquiring the IP address of an HSvr host according to the HCode, and the method is used for achieving dynamic maintaining of the corresponding relation of the HCode and a corresponding domain name. The invention further discloses an addressing method, and the HSvr can determine a corresponding attributive HSvr according to the GUID of information. The invention further discloses the HSvr which is used for achieving information exchanging between cross-domain users.

Description

Communication means and system
Technical field
The present invention relates to internet communication, relate to communication means and the system of striding service-domain or rather.
Background technology
Instant messaging (IM, Instant Messenger) service is once having deep love for of numerous Internet users occurring being subjected to, such as, the ICQ by Israel technical staff exploitation of America Online (AOL) purchase, the MSN of Microsoft, the QQ of Tengxun, the Hi of Baidu, Google Talk etc. instantaneous communication system (IMS, IM System) provides comprises that literal is mutual, interactive voice, video interactive etc. instant messaging service.An IMS generally comprises an instant communication server (IMSvr, IM Server) and belongs to this IMS, also namely belongs to one group of Internet user (IUsr, Internet User) of corresponding IMSvr.IMS generally adopts C/S architecture or B/S architecture, IUsr by client or its ownership of browser access IMSvr and other IUsr that belong to this IMSvr carry out information interaction.Know-why about instant messaging, the host-host protocol of instant messaging, for example instant messaging universal architecture agreement (CPIM), and different service providers (SP, Service Provider) architectural framework of IMS, and the composition of server end, as the architecture of MSN, numerous papers or academic report are arranged, carried out introducing widely, therefore, the present invention repeats no more, and does not also select.
An IMS inside, can realize between each IUsr intercoming mutually, for example text chat or voice conversation can be carried out between two QQ users, or also corresponding information interaction can be carried out between two Hi users.Panoramic, seem colourful IMS and bring great convenience for people's communication.
But between the IUsr of different IMS, for example a QQ user but can't carry out straightway communication as the telephone subscriber of China Mobile and China Telecom with a Hi user.The hedge that can't cross between each IMS has limited the freedom of user communication, and and then has influence on the freedom that the user selects operator.
Though interconnect between the email service system, do not satisfy the real-time requirement of information interchange, for example text chat, voice or video calling.
Summary of the invention
In view of this, the present invention is based on global Unified Identity, a kind of communication means is provided, realize the intercommunication of the IUsr of different IMS by this method.
A kind of communication means is characterized in that, sets up the corresponding relation of HCode and HSvr in advance, said method comprising the steps of:
A, client will comprise that the message of purpose GUID sends to the HSvr of ownership, i.e. local HSvr;
B, described local HSvr determine the HSvr of described purpose GUID ownership according to the corresponding relation of described HCode and HSvr, and namely opposite end HSvr will comprise that the message of purpose GUID sends to this opposite end HSvr;
C, described opposite end HSvr according to the purpose GUID in the message, send to this purpose GUID clients corresponding with this message after receiving message from described local HSvr.
Described local HSvr sets up SS with at least one opposite end HSvr and is connected, and preserves the corresponding relation of SS connection and HCode; Step b is described according to described purpose GUID, according to the corresponding relation of described HCode and HSvr, determines that opposite end HSvr refers to, according to the HCode of described purpose GUID, according to the corresponding relation of the SS connection of preserving with HCode, determines that corresponding SS connects; The described message that will comprise purpose GUID sends to this opposite end HSvr and refers to, connects by the SS that determines, will comprise that the message of purpose GUID sends.
The present invention is the method for the corresponding relation that is connected with SS of dynamic-configuration HCode openly also, has reduced the system maintenance cost.
The method of the corresponding relation that a kind of dynamic-configuration HCode is connected with SS is characterized in that, said method comprising the steps of:
A, HSvr are according to addressing purpose GUID, according to the corresponding relation of the SS connection of preserving with HCode, obtaining corresponding SS connects, judge whether to obtain, if can not get corresponding SS connects, then according to described addressing purpose GUID, obtain corresponding host IP address according to the HCode that sets up in advance with the corresponding relation of HSvr;
B, connect described opposite end HSvr according to this host IP address, set up SS and connect;
The SS connection that c, preservation obtain and the corresponding relation of the HCode of described addressing purpose GUID.
The present invention also discloses a kind of message switching method, allows HSvr improve message efficient.
A kind of message switching method is characterized in that, sets up the corresponding relation that HCode is connected with SS; Said method comprising the steps of:
A, according to the HCode of addressing purpose GUID in the message, the corresponding relation according to described HCode is connected with SS carries out addressing, obtains corresponding SS and connects;
B, connect by the SS that obtains described message is sent to opposite end HSvr.
The present invention also openly verifies source client and the conforming method of source IUsr, helps subscription client to realize the caller identification function.
A kind of checking source client and the conforming method of source IUsr is characterized in that, said method comprising the steps of:
A, purpose client are from the IP address of the HSvr reception sources IUsr correspondence of purpose IUsr ownership; The connection request of purpose client reception sources client, the message bag of receiving by parsing obtains source IP address;
Perhaps, the connection request of purpose client reception sources client, the message bag of receiving by parsing obtains source IP address; The purpose client is from the IP address of the HSvr reception sources IUsr correspondence of purpose IUsr ownership;
B, judge whether the corresponding IP address of described source IP address and the source IUsr of reception is consistent, if consistent, then, consistency checking passes through, otherwise, do not pass through.
The present invention also discloses cross-domain CC and connects method for building up, is used for realizing the direct communication of cross-domain IUsr.
A kind of cross-domain CC connects method for building up, it is characterized in that, said method comprising the steps of:
A, source client will comprise that the message request of purpose IUsr information sends to the HSvr of source IUsr ownership, i.e. source HSvr;
The IP address that b, described source HSvr obtain source IUsr will comprise that the invitation message of the good purpose IUsr of GUID of IP address, the source IUsr of described source IUsr sends to the HSvr of described purpose IUsr ownership, i.e. purpose HSvr;
C, described purpose HSvr obtain the IP address of described purpose IUsr; The IP address of described purpose IUsr is replied to source HSvr, should reply message by source HSvr and send to described source client, described source client receives described answer message; Described invitation message is sent to purpose IUsr clients corresponding;
D, described purpose client are initiated connection request according to the IP address of the source IUsr that receives to the source client, described source client is obtained the peer IP address of connection request, judge whether this IP address is the IP address of purpose client described in the described answer message, if, then accept connection request, and set up the CC connection; Perhaps described source client is initiated connection request according to the IP address of the purpose IUsr that receives to the purpose client, described purpose client is obtained the peer IP address of connection request, judge whether this IP address is the IP address of source client described in the described invitation message, if, then accept connection request, and set up the CC connection.
The present invention also discloses a kind of addressing method, makes HSvr can determine the HSvr of respective home according to the GUID of message.
A kind of GUID addressing method is characterized in that, said method comprising the steps of:
A, set up the corresponding relation of HCode and HSvr;
B, according to the HCode of the GUID correspondence corresponding relation according to described HCode and HSvr, determine the HSvr of this GUID ownership.
8. method according to claim 7 is characterized in that, step a refers to:
The corresponding relation of described HCode and HSvr is kept at this locality, and corresponding, step b refers to: determine the HSvr that this GUID belongs to the described HCode that preserves from this locality according to the HCode of GUID correspondence and the corresponding relation of HSvr;
Perhaps, foundation communicates to connect with GUIDAS's, and described GUIDAS has preserved the corresponding relation of HCode and HSvr, and corresponding, step b refers to: according to the HCode of GUID correspondence, visit GUIDAS obtains the HSvr of this GUID ownership;
Perhaps, the corresponding relation of the described HCode of foundation and HSvr is that the domain name constructing module is set, and is corresponding, step b refers to: according to the HCode of GUID correspondence, by the domain name constructing module that arranges, produce HDomain, by resolving the HSvr that the HDomain that produces determines that this GUID belongs to.
The present invention also openly obtains the method for HSvr host IP address according to HCode, be used for realizing the Dynamic Maintenance of HCode and corresponding domain name corresponding relation.
A kind ofly obtain the method for HSvr host IP address according to HCode, it is characterized in that, set in advance the domain name constructing module, said method comprising the steps of:
A, according to this HCode, by the domain name constructing module that arranges, obtain the HDomain of this HCode correspondence;
B, by the HDomain that obtains is resolved, obtain corresponding host IP address.
The present invention also discloses a kind of HSvr, be used for to realize striding the message between the user of IMS system.
A kind of HSvr is characterized in that, comprises central processing module, communication access module, memory module;
Described communication access module is used for the access communications network, carries out information interaction with client; Described communication access module also is used for setting up being connected with the SS of other HSvr, connects with described other HSvr by the SS that sets up and carries out information interaction;
Described storage module is used for preserving the corresponding relation that HCode is connected with SS;
For the message that comprises purpose GUID that receives, central processing module according to the HCode that sets up and the corresponding relation of HSvr, carries out addressing according to the HCode of purpose GUID in the message, determines that corresponding SS connects; To comprise that by the SS connection of determining the message of purpose GUID sends to opposite end HSvr.
By communication means provided by the invention, the IUsr that belongs to different IMS can realize intercoming mutually, thereby has made things convenient for the communication of IUsr, helps to promote Internet development.
Description of drawings
Shown in Figure 1, be the IMS networking diagram that interconnects.
Shown in Figure 2, be the networking diagram that interconnects of the IMS based on GUIDAS.
Shown in Figure 3, for the present invention strides IMS communication embodiment flow chart.
Corresponding relation flow chart shown in Figure 4, as to be connected with SS for dynamic-configuration HCode of the present invention.
Shown in Figure 5, be HSvr of the present invention system composition diagram in the frame of broken lines.
Shown in Figure 6, connect the system group network figure of GUIDAS outward for HSvr.
Embodiment
Identifying an Internet user in the world, is to belong to the basis of interconnecting between the user of different IMS.For example, for the IUsr:UsrA that belongs to two different IMSs and UsrB, UsrA will stride the instant messaging of IMS with UsrB, UsrA will know the global Unified Identity (GUID of UsrB so, Global Unified Identity), to determine that UsrB is which user of which IMS.Otherwise UsrB will know the GUID of UsrA.
GUID comprises two parts: ownership sign indicating number (HCode, Home Code) and user code (UCode, User Code).Wherein, HCode indicates this GUID, and also namely the user attaching of this GUID correspondence is in which IMS, and UCode is used to indicate different user under the HCode.
An IMS can have a plurality of HCode.
In the present invention, the HCode of an IUsr refers to the HCode of the GUID correspondence of this IUsr.In the present invention, the IMSvr among IMS is also referred to as the attribution server (HSvr, Home Server) of the IUsr of this IMS.
HSvr generally is made up of a plurality of logic modules, and these logic modules also often are called as different servers according to the division of labor is different, in fact constitutes a HSvr group.For example the server group of MSN comprises three class servers:
Announcement server (NSvr, Notification Server).During the MSN session, client needs to keep and it be connected always, and a lot of tasks will be finished in this session, comprises login, change state, obtains user list, modification user profile, initiation chat, mail notification, withdraws from etc.
Transfer server (SSvr, Switch Server).Be responsible for the chat message between the transfer client.
Dispatch server (DSvr, DisPatch Server).Before the client login NSvr, at first connect this server.It can accomplish the ability according to client, protocol version for example, and client region, the perhaps sign of client, and the load of each NSvr, come to select suitable NSvr for client, and send the IP(Internet Protocol of the NSvr that selects to this client) address and port numbers.After client was received IP address and the port numbers of NSVr and beamed back affirmation, the DSvr disconnection was connected with this client.In some manuscript, also be referred to as dispatching server.
About the architectural framework of HSvr group, slightly have any different because IMS is different, the present invention no longer selects.
As shown in Figure 1, be the IMS networking diagram that interconnects.In Fig. 1, the HSvr of A service provider (SP-A) is HSvr-A, and wherein, registration has user A(UsrA) and user X(UsrX); The HSvr of B service provider (SP-B) is HSvr-B, and wherein, registration has user B(UsrB) and user Y(UsrY); The HSvr of C service provider (SP-C) is HSvr-C, and wherein, registration has user C(UsrC) and user Z(UsrZ).
For ease of understanding, in the description of back, we with, SP-A is that Tengxun, SP-B are that Netease, SP-C are Microsofts, is example.
In the middle of the reality, HCode has dissimilar.For ease of describing, introduce two types HCode here.
Domain name kind HCode:HCode is a domain name, and corresponding GUID is an addresses of items of mail (is called for short and posts the location), and UCode wherein posts the user name of location for this.At this moment, the GUID representation is generally: user name @ domain name, @ is for posting the location designator here.
For example, HSvr-A has domain name kind HCode such as qq.com; HSvr-B has two domain name kind HCode such as 163.com and yeah.net; HSvr-C has hotmail.com and two domain name kind HCode of live.com.Three users' of Netease such as zhangliao@163.com, simayi@163.com and zhangliao@yeah.net GUID belongs to HSvr-B.
International merchant's sign indicating number (IBC, International Business Code) class HCode:HCode is an IBC, and corresponding UCode is one-level user ID (FLUI, First Level User Identity).Corresponding GUID is principal and subordinate's sign indicating number (MsC, Master-slave Code).At this moment, the GUID representation is generally: FLUI#IBC, here, # is the MsC designator.
Wherein, IBC or FLUI can be alphabetical, digital combination in any.For example, HSvr-A has two IBC such as QQ and 99; HSvr-B has 163 and two IBC such as WY; HSvr-C has 352 and two IBC of MSN.And the HSvr of Baidu has Hi, two IBC such as 816; The HSvr of Google has three IBC such as Ggl, Gtalk and 900.For example, for the existing instant messaging number of the account of this Tengxun of QQ number, arranging its corresponding IBC is QQ, and then the MsC of QQ number 123789 correspondences is 123789#QQ; If Tengxun is because at present newly-increased QQ number is oversize, and provide a kind of TC number, and the corresponding IBC of agreement is 88, then the MsC of TC number 123789 correspondences is 123789#88.Equally, the IBC of the Hi number of the account correspondence of agreement Baidu is Hi, and then the MsC of a Hi user name simayi correspondence is simayi#Hi.
Make UsrA send information to UsrB by HSvr-A, HSvr-A just need know that UsrB belongs to that HSvr so, in order to will send to this HSvr from the described information of UsrA.The present invention makes a HSvr to determine according to the corresponding relation of described foundation which HSvr this IUsr belongs to according to the HCode of an IUsr by setting up the corresponding relation of HCode and HSvr.
Provide several modes of setting up the corresponding relation of described HCode and HSvr to supply technical staff's reference below:
The corresponding relation of mode one, the described HCode of foundation and HSvr is: the corresponding relation of setting up the host IP address of HCode and HSvr.As shown in table 1:
Table 1
HCode The HSvr host IP address HSvr
163 The host IP address of HSvr-B HSvr-B
163.com The host IP address of HSvr-B HSvr-B
352 The host IP address of HSvr-C HSvr-C
99 The host IP address of HSvr-A HSvr-A
Hotmail.com The host IP address of HSvr-C HSvr-C
live.com The host IP address of HSvr-C HSvr-C
MSN The host IP address of HSvr-C HSvr-C
QQ The host IP address of HSvr-A HSvr-A
qq.com The host IP address of HSvr-A HSvr-A
WY The host IP address of HSvr-B HSvr-B?
yeah.net The host IP address of HSvr-B HSvr-B
According to table 1, a HSvr can obtain the host IP address of corresponding HSvr according to a HCode.
Table 1 also can be split into a plurality of tables according to the HCode type.For example, the corresponding relation of domain name and HSvr is put in the table, shown in table 1-1; The corresponding relation of IBC and HSvr is put in the another one table, shown in table 1-2.
Table 1-1
HCode The HSvr host IP address Remark
163.com The host IP address of HSvr-B HSvr-B
Hotmail.com The host IP address of HSvr-C HSvr-C
live.com The host IP address of HSvr-C HSvr-C
qq.com The host IP address of HSvr-A HSvr-A
yeah.net The host IP address of HSvr-B HSvr-B
Table 1-2
HCode The HSvr host IP address Remark
163 The host IP address of HSvr-B HSvr-B
352 The host IP address of HSvr-C HSvr-C
99 The host IP address of HSvr-A HSvr-A
MSN The host IP address of HSvr-C HSvr-C
QQ The host IP address of HSvr-A HSvr-A
WY The host IP address of HSvr-B HSvr-B?
The corresponding relation of mode two, the described HCode of foundation and HSvr is: the corresponding relation of setting up the domain name of HCode and the corresponding HSvr of sensing.It is home domain name (HDomain, Home Domain) that the present invention claims to be used in reference to the domain name of the host IP address of HSvr.For example, by being set, HCode and the mapping table of the domain name of pointing to corresponding HSvr set up the corresponding relation of described HCode and HSvr, as showing shown in the 1-3:
Table 1-3
HCode HDomain HSvr
163 Point to the domain name of HSvr-B HSvr-B
163.com Point to the domain name of HSvr-B HSvr-B
352 Point to the domain name of HSvr-C HSvr-C
99 Point to the domain name of HSvr-A HSvr-A
Hotmail.com Point to the domain name of HSvr-C HSvr-C
live.com Point to the domain name of HSvr-C HSvr-C
MSN Point to the domain name of HSvr-C HSvr-C
QQ Point to the domain name of HSvr-A HSvr-A
qq.com Point to the domain name of HSvr-A HSvr-A
WY Point to the domain name of HSvr-B HSvr-B?
yeah.net Point to the domain name of HSvr-B HSvr-B
According to table 1-3, a HSvr can obtain the domain name of pointing to corresponding HSvr according to a HCode
According to mode two, also set up the corresponding relation of the host IP address of domain name and corresponding HSvr, for example, domain name is host name, in name server (DNS, Domain Name Server), by the A record is set, described host name is directly pointed to the host IP address of corresponding HSvr; Perhaps, in DNS, by canonical name is set, domain name is pointed to indirectly the host IP address of corresponding HSvr.Like this, according to a HCode, corresponding domain name can be obtained, host IP address pointed can be obtained by resolving this domain name again.
All under the clearer and more definite situation, HSvr can set up the corresponding relation of described HCode and HSvr in this locality at HSvr and HCode.Generally, HSvr can not determine HSvr and the corresponding HCode that will connect in advance fully, to this, a server (GUIDAS of GUID alliance also can be set, GUID Alliance Server), the corresponding relation of described HCode and HSvr is saved among this GUIDAS, as shown in Figure 2.
According to mode one, each HSvr can directly obtain the host IP address of the HSvr of a HCode correspondence by visit GUIDAS.
Be understood that, according to mode two, if the corresponding relation of described HCode and HSvr is preserved in this locality, perhaps in GUIDAS, preserve, then according to a HCode, from local search, perhaps visit GUIDAS, can obtain corresponding domain name; By domain name mapping, obtain the host IP address of this HCode correspondence again.
The corresponding relation of mode three, the described HCode of foundation and HSvr is: the domain name constructing module is set, by the domain name constructing module that arranges, comes to produce corresponding HDomain according to HCode.For example, the domain name constructing module arranges domain name constructed fuction or domain name building method or domain name structure expression formula, by domain name constructed fuction or domain name building method or the domain name structure expression formula that arranges, comes to produce corresponding HDomain according to HCode.
Correspondingly, in the DNS of correspondence, allow this HDomain directly or indirectly point to the HSvr host IP address.For example, in DNS, by the A record is set, allow this HDomain directly point to the HSvr host IP address, perhaps, by canonical name is set, allow this HDomain point to the HSvr host IP address indirectly.
For domain name kind HCode, described expression formula can directly be HCode, and namely the HDomain of a HCode correspondence is this HCode self.
Consider the needs of extensibility, for domain name kind HCode, preferably, domain name is made of a subdomain " HomeServer " of HCode and setting.At this moment, can arrange domain name structure expression formula is: " HomeServer. "+HCode, like this, the HDomain of HCode value 163.com correspondence is HomeServer.163.com, and the HDomain of HCode value yeah.net correspondence is HomeServer.yeah.net.In DNS, by adding corresponding A record or canonical name, with the host IP address of HomeServer.163.com and HomeServer.yeah.net sensing HSvr-B.Equally, the HDomain of HCode value qq.com correspondence is HomeServer.qq.com, in DNS, by adding the host IP address that corresponding A record or canonical name point to HomeServer.qq.com HSvr-A.By domain name mapping, can obtain the HSvr host IP address of a HDomain correspondence.Like this, for this GUID of zhangliao@163.com, HSvr-A is HomeServer.163.com by the HDomain that domain name structure expression formula obtains, and by resolving HomeServer.163.com, obtains the IP address of HSvr-B.
For IBC class HCode, domain name is made of a TLD " IBCode " of HCode and setting.At this moment, can arrange domain name structure expression formula is: HCode+ " .IBCode ".Like this, the HDomain of IBC value 163 correspondences is 163.IBCode, and the HDomain of IBC value WY correspondence is WY.IBCode.In DNS, by adding corresponding A record or canonical name, with the host IP address of 163.IBCode and WY.IBCode sensing HSvr-B.Equally, the HDomain of IBC value 99 correspondences is 99.IBCode, in DNS, by adding the host IP address that corresponding A record or canonical name point to 99.IBCode HSvr-A.Like this, for this GUID of zhangliao#163, HSvr-A is 163.IBCode by the HDomain that domain name structure expression formula obtains, and by resolving 163.IBCode, obtains the IP address of HSvr-B.
Certainly, for the HCode of any kind, can constitute by a TLD " guidtld " of this HCode and setting.At this moment, by agreement domain name structure expression formula be: HCode+ " .guidtld ".Like this, the HDomain of HCode value 163.com correspondence is 163.com.guidtld, and the HDomain of HCode value WY correspondence is wy.guidtld.In DNS, by adding corresponding A record or canonical name, with the host IP address of 163.com.guidtld and wy.guidtld sensing HSvr-B.
Can be by a MX(Mail Exchanger) record directly or indirectly points to a domain name host IP address of corresponding HSvr.
In the middle of the reality, can increase new record type in DNS, the present invention is referred to as the H type, is used to refer to one and is recorded as the H record.Record the host IP address that a domain name is directly or indirectly pointed to corresponding HSvr by a H.In this case, for domain name kind HCode, described expression formula can directly be HCode, and namely the HDomain of a HCode correspondence is this HCode self.For example, the record of the H among the DNS can be as shown in table 2.
Table 2
Title Refresh interval Type Host name or IP address
163.com 3600 seconds H 119.84.66.17
yeah.net 3600 seconds H 163.com
99.IBCode 3600 seconds H 119.147.15.56
According to the H record shown in the table 2, wanting accessed record according to a domain name and being used to indicate is the record type value of H record, can obtain the host IP address of correspondence by visit DNS.
According to mode three, the corresponding relation that the domain name constructing module is set up described HCode and HSvr is set, the domain name constructing module by arranging to produce corresponding HDomain according to HCode like this.Further by domain name mapping, for example, according to this HDomain, by visit DNS, obtain the host IP address of this HCode correspondence.
Like this, the HCode that pass-through mode one or mode two or mode three are set up and the corresponding relation of HSvr according to a HCode, can obtain corresponding host IP address.
A HSvr can be according to the HCode of a GUID, corresponding relation according to described HCode and HSvr obtains corresponding host IP address, by judging whether corresponding host IP address is the IP address of this HSvr oneself, and this HSvr can confirm whether this GUID belongs to oneself.
Preferably, HSvr further preserves one's own relevant HCode, whether is a kind of HCode of special shape and the corresponding relation of HSvr, like this, be that one's own HCode can confirm directly whether a GUID belongs to oneself by the HCode that judges a GUID.
HSvr can read one's own HCode from self HCode configuration file.Perhaps, HSvr reads one's own domain name from self domain name configuration file, reads one's own IBC from self IBC configuration file.
In the middle of the reality, also can set up the corresponding relation of IBC class HCode and HSvr according to mode one or mode two, and set up the corresponding relation of domain name kind HCode and HSvr according to mode three.
Above-mentioned by setting up the corresponding relation of HCode and HSvr, HSvr-A can obtain the host IP address of the HSvr that a GUID belongs to.Usually, when HSvr-A finds that the host IP address of a corresponding HSvr of not one's own HCode is the host IP address of oneself, can be used as abnormality processing.
UsrA sends message by HSvr-A to UsrB, carries out according to following steps:
The message that step 101, UsrA will carry the address information of UsrB sends to HSvr-A.
Step 102, HSvr-A receive the message from UsrA, carry out addressing according to the address information of UsrB,, determine the HSvr of UsrB ownership, i.e. HSvr-B according to the HCode of the address information correspondence of UsrB that is; The message of having carried the address information of UsrB is sent to this HSvr-B.
Here, HSvr-A is according to the HCode of the address information correspondence of UsrB, obtains the host IP address of corresponding HSvr according to the corresponding relation of the HCode that sets up and HSvr, related news sent to the HSvr of described correspondence according to this IP address.Because UsrB belongs to HSvr-B, namely the HCode of its address information correspondence is corresponding to HSvr-B, and therefore, the message that HSvr-A just will carry the address information of UsrB sends to HSvr-B.
Step 103, HSvr-B receive the message from HSvr-A, according to the address information of UsrB, described message are sent to UsrB.
Like this, UsrB just can be by the message of HSvr-B reception from UsrA.
As shown in Figure 3, stride IMS communication embodiment flow chart for the present invention.
So just realized that UsrA sends the purpose of message to UsrB by HSvr-A.According to the same manner, UsrB can send message to UsrA by HSvr-B.So just realized the information interaction of UsrA and UsrB.
Here, the address information of an IUsr can be the part of the GUID of this IUsr, UCode for example, or all.Describe for simplifying, the follow-up IUsr address information of mentioning is whole for the GUID's of this IUsr.
In the middle of the reality, UsrA sends message also may for the user in this IMS, and for example UsrA sends message to UsrX.Therefore, step 102 further is, HSvr-A judges whether UsrB belongs to oneself, and namely whether the HCode of UsrB is had by HSvr-A, if then directly according to the GUID of UsrB, described message is sent to UsrB after receiving message from UsrA; If UsrB does not belong to oneself, namely the HCode of UsrB is not had by HSvr-A, then determines the HSvr of UsrB ownership according to the HCode of UsrB, and the message of having carried the GUID of UsrB is sent to this HSvr.Perhaps, step 102 further is, after HSvr-A receives message from UsrA, determine the HSvr of UsrB ownership according to the HCode of UsrB, judge whether this HSvr is HSvr-A self (for example whether the IP address is identical), if, then directly according to the GUID of UsrB, described message is sent to UsrB, process ends; If not, the message that then will carry the GUID of UsrB sends to this HSvr.
It can be by IP-based UDP(User Datagram Protocol that above-mentioned message sends) packet is finished, and also can be to fetch by the communication link of setting up to finish.
In step 101, UsrA can send related news to HSvr-A by the UDP message bag.UsrA also can establish a communications link with HSvr-A (the present invention claims client, comprises browser, to the connection for CS that communicates to connect of server), connects by the CS that sets up to send described message to HSvr-A.
In step 102, HSvr-A can send related news to HSvr-B by the UDP message bag.HSvr-A also can establish a communications link with HSvr-B (the present invention claims HSvr to be connected to communicating to connect to SS of HSvr), connects by the SS that sets up to send described message to HSvr-B.
Usually, described CS connection is TCP(Transmission Control Protocol) connect.It can be that TCP connects that described SS connects, and also can be to adopt other technology, and what for example ATM (Asynchronous Transfer Mode) technology, or agreement was set up communicates to connect.Being connected with SS with described CS connection below is that TCP is connected to example.
In step 103, HSvr-B can send to UsrB by the UDP message bag with described message according to IP address and the port numbers of preserving in advance.Also can be that UsrB has set up CS with HSvr-B and is connected, HSvr-B connects by this CS described message is sent to UsrB.
In step 103, was not connected if HSvr-B both sets up CS with UsrB, do not preserve the IP address of UsrB yet, then the direct end process of HSvr-B is perhaps preserved this message, UsrB is next by the time login after, send to UsrB.
When setting up the CS connection, usually, be that HSvr provides IP address and port numbers as the TCP server, connected by sending connection request by subscription client.Being used for setting up tcp server port that CS connects number can also can be unified to arrange by each IMS oneself regulation.
When setting up SS and connecting, usually, be that the HSvr that receives connection request provides IP address and port numbers as the TCP server, brought in as TCP client by the HSvr that initiates connection request and connect.Usually, unified agreement HSvr port numbers, for example, arranging unified port numbers is 1868.Certainly, also can not arrange unified port numbers, for example, in table 1, increase port number field, set up tcp server port that SS connects number in order to being used for of specializing that corresponding HSvr provides.
Usually, connect at the TCP that sets up, Hu Tongxin both sides respectively have a socket (Socket) correspondingly mutually, referring to the technical data of unix or linux socket aspect.Socket is a data structure that description communicates to connect, and generally comprises five part essential informations: protocol description information, local ip address, local port number, peer IP address and peer port number.Though, by local ip address, local port number, four partial informations such as peer IP address and peer port number can uniquely determine that a TCP is connected.But, use for making things convenient for application layer, at described data structure, there is a numbering corresponding with it, usually, claims this to be numbered socket descriptor (SktD, Socket Descriptor), like this, application layer just can be identified different TCP by different SktD and connect.
For example, the TCP server produces a socket by Socket () function call, obtains a SktD, and by bind () function call, this socket is carried out the local parameter initialization.The TCP server is converted to this socket by listen () function call and intercepts socket, in order to wait for the connection request of client, and obtain socket at different TCP clients by accept () function call, and SktD, this SktD as the parameter that sends function send () or receiver function recv (), can be carried out transmission or the reception of data.
Also for example, the TCP client produces a socket by Socket () function call, obtain a SktD, and by connect () function call, this socket is carried out initialization, after successful initialization, the SktD of correspondence as the parameter that sends function send () or receiver function recv (), can be carried out transmission or the reception of data.
Usually, connect for CS, HSvr intercepts the connection request that the IUsr side is initiated as the TCP server, and when setting up the TCP connection, creates the socket (USoSS, UserSide-oriented Server Socket) towards the IUsr side.Connect for SS, HSvr intercepts the connection request that other HSvr initiates as the TCP server, and when setting up the TCP connection, creates the socket (PHoSS, PeerHSvr-oriented Server Socket) towards other HSvr; HSvr initiates connection request as the TCP client to other HSvr, and when setting up the TCP connection, creates the socket (PHoCS, PeerHSvr-oriented Client Socket) towards other HSvr.
In the middle of the reality, understanding informed source for the ease of UsrB, in step 102, when the message of the GUID that will carry UsrB sends to HSvr-B, also carry the relevant information of UsrA in message, usually is the GUID that carries UsrA.Correspondingly, in step 103, HSvr-B sends to UsrB according to the GUID of UsrB with the described message of having carried the GUID of UsrA.
If HSvr-A does not set up the client of UsrA and the corresponding relation of UsrA, for example, UsrA does not log on HSvr-A, and then in step 101, UsrA also is included in the GUID of oneself in the described message.For example, UsrA sends described message by a UDP message bag.
If HSvr-A has set up the client of UsrA and the corresponding relation of UsrA, for example, UsrA has logined HSvr-A, and then HSvr-A can obtain the GUID of UsrA according to the client that sends message according to described corresponding relation.
In the middle of the reality, when HSvr registered the user, according to the registration account number, namely GUID had preserved corresponding password, the user account information table that ginseng is shown in Table 4.
Table 4
GUID Password Remark
The GUID of UsrB ******** The account record of UsrB
The GUID of UsrY ******** The account record of UsrY
Usually, comprise these base attributes: GUID, Password, ClientIP and ClientPort in an accounts information.Wherein, Password is account password, and ClientIP and ClientPort are the online information of the account.Be in when logining state when the account, IP address and the port numbers of the client of ClientIP and ClientPort corresponding account were in when publishing state when the account, and usually, ClientIP and/or ClientPort are null value null or 0.
HSvr can obtain IP address and the port numbers of corresponding client when the login of account, and among the ClientIP and ClientPort attribute that the IP address that obtains and port numbers are kept at the account.
The attribute information of an account can be deposited in the table.For example, can in user account information table as shown in table 4, increase IP address and the port numbers that ClientIP and ClientPort field are preserved the client of corresponding account.
Consider that not all account all is in the state of logining, therefore, also can preserve the client-side information of an account by online user message table is set.As shown in table 3.
Table 3
GUID The IP address Port Remark
The GUID of UsrB The IP address of UsrB The port numbers of UsrB The online information of UsrB
The GUID of UsrY The IP address of UsrY The port numbers of UsrY The online information of UsrY
In table 3, preserved the corresponding relation of a GUID and relative client, wherein, identify a client with client ip address and port numbers.
Like this, just can preserve the accounts information of an account by online user's information table as shown in table 3 and user account information table as shown in table 4.
Provide two kinds of modes of logining HSvr below:
Mode one, client send to Hsvr by the UDP message bag and land request message, GUID and password are landed in indication in landing request message, after HSvr receives this packet, obtain the corresponding password of preserving according to this GUID, login request message is verified, when checking is passed through, preserve the corresponding relation of this GUID and relative client, for example, according to described login GUID, IP address and the port numbers of the client obtained is kept in online user's information table as shown in table 3.Whether for example, whether the password that judgement is preserved and the password of reception be consistent, for example equate, if consistent, then checking is passed through, otherwise, verify and do not pass through.
Mode two, client-requested HSvr set up TCP and connect, and after being connected to HSvr, send log messages, GUID and password are landed in indication in login message, after HSvr receives this log messages, from user account information as shown in table 4, obtain corresponding password according to this GUID, this log messages is verified, when checking is passed through, preserve the corresponding relation of this GUID and relative client.Whether for example, whether the password that judgement is preserved and the password of reception be consistent, for example equate, if consistent, then checking is passed through, otherwise, verify and do not pass through.
Referring to the online user's information table shown in the table 3-1.
Table 3-1
GUID CS connects Remark
The GUID of UsrB The SktD of CS1 The online information of UsrB
The GUID of UsrY The SktD of CS2 The online information of UsrY
In table 3-1, the sign that connects with CS is as the sign of relative client.
Like this, just can preserve the accounts information of an account by the online user's information table shown in table 3-1 and user account information table as shown in table 4.
According to mode one or mode two, HSvr can also return the successful message of login to logging on client after log messages is proved to be successful.
Based on mode two, HSvr can also further preserve IP address and the port numbers of the corresponding client of obtaining.Referring to showing the online user's information table shown in the 3-2:
Table 3-2
GUID CS connects The IP address Port Remark
The GUID of UsrB The SktD of CS1 The IP address of UsrB The port numbers of UsrB The online information of UsrB
The GUID of UsrY The SktD of CS2 The IP address of UsrY The port numbers of UsrY The online information of UsrY
As show shown in the 3-2, if client does not need to carry out with HSvr other information interaction, so, client has been registered the IP address of oneself in HSvr after, can also disconnect and being connected of HSvr.Correspondingly, the corresponding CS connection of HSvr is set to a particular value, for example-100, represents that corresponding TCP connection disconnects.In this case, HSvr can identify a client with client ip address and port numbers.In this case, when client changes in the IP address of oneself, in HSvr, register new IP address again.
When client withdraws from, HSvr can be from described online user's information table with the record deletion of this client correspondence.
Need to prove, HSvr or during the UDP message bag, can obtain the IP address of opposite end by resolving corresponding IP protocol header when receiving the connection request of TCP client or other HSvr, by resolving corresponding Transmission Control Protocol head or udp header, can obtain the port numbers of opposite end.For example, use the socket technology, HSvr can obtain IP address and the port numbers of TCP client by accept () function when accepting connection request.HSvr can also obtain IP address and the port numbers of TCP client by getpeername () function.
Certainly, also can specify IP address or the port numbers of described client at the data division (non-protocol header) of log messages.Correspondingly, the IP address of preserving the client of obtaining according to described GUID can be to preserve described specially appointed IP address according to this GUID.
Can further include login time etc. the information of client type, version number and subscription client in the described log messages.For example described client type is proprietary type, the QQ client of Tengxun for example, and Hi client of Baidu etc. C type client also can be universal class, for example the client of browser form, i.e. category-B type client.
According to table 3-2, when customer end adopted mode one was logined, corresponding CS connection was set to particular value, for example-100.
According to the online user's information table shown in table 3-2, HSvr can obtain corresponding GUID according to the client that sends message.Like this, in step 101, described message can not carried the relevant information of UsrA, correspondingly, in step 102, HSvr-A is further according to the SktD of corresponding CS connection or according to relative client IP address and port numbers, obtain the GUID of UsrA according to the online user's information table shown in table 3-2, like this, when HSvr-A sends to HSvr-B in the message of the GUID that will carry UsrB, just can further in message, carry the GUID of the described UsrA that obtains.
The back is that table 3-1 is that example further specifies the present invention with described online user's information table.
Be connected by setting up CS with HSvr that to carry out information interaction be example with HSvr with IUsr below.
For example, UsrA sets up CS with HSvr-A and is connected, and signs in to HSvr-A, and HSvr-A preserves the corresponding relation of UsrA and relative client by the online user's information table shown in table 3-1; UsrB signs in to HSvr-B, and HSvr-B preserves the corresponding relation of UsrB and relative client by the online user's information table shown in table 3-1.At this moment, UsrA sends message by HSvr-A to UsrB, can carry out according to following steps:
Step 201, UsrA send to HSvr-A by the message that the CS that sets up connects the GUID that will carry UsrB.
Step 202, HSvr-A connect by this CS, and also the SktD that namely connects according to this CS receives the message from UsrA, according to the SktD that this CS connects, obtain the GUID of UsrA according to the online user's information table shown in table 3-1.GUID according to UsrB carries out addressing, that is, judge whether UsrB belongs to oneself, and namely whether the HCode of UsrB is had by HSvr-A, if, then directly according to the GUID of UsrB, determine that according to the online user's information table shown in table 3-1 corresponding CS connects, and also is, obtain the SktD that this CS connects, connect by this CS, also namely according to this SktD, described message is sent to UsrB.Because UsrB do not belong to oneself, namely the HCode of UsrB is not had by HSvr-A, therefore, determines the HSvr that UsrB belongs to according to the HCode of UsrB, and the message of having carried the GUID of the GUID of UsrB and UsrA is sent to the HSvr that UsrB belongs to.
Here, HSvr-A according to the corresponding relation of described HCode and HSvr, obtains the host IP address of corresponding HSvr according to the HCode of UsrB, related news is sent to the HSvr of described correspondence according to this IP address.Because UsrB belongs to HSvr-B, namely its HCode is corresponding to HSvr-B, and therefore, the message that HSvr-A just will carry the GUID of the GUID of UsrB and UsrA sends to HSvr-B.
Step 203, HSvr-B receive the message from HSvr-A, determine that according to the online user's information table shown in table 3-1 the CS of UsrB correspondence connects, and also is according to the GUID of UsrB, obtain the SktD that this CS connects, connect by this CS, also namely according to this SktD, described message is sent to UsrB.
Step 204, UsrB receive the message that HSvr-B sends.
Certainly, in step 101 step 201, when the message that UsrA will carry the address information of UsrB sends to HSvr-A, also can be with the address information of oneself, for example the GUID of oneself is included in the described message.
The present invention for convenience of description defines a kind of simple message format here, but is not used in restriction the present invention:
ToUsr: being used to specify the destination address of message, usually, is the part or all of of purpose user GUID;
FromUsr: being used to specify the source address of message, usually, is the part or all of of source user GUID;
MsgCode: message code (MsgCode, Message Code): for example, ShortMsg represents that this is a short message.
MsgContent: message content.
Like this, just can be filled up to the GUID of UsrB among the ToUsr, the GUID of UsrA is filled up among the FromUsr.
In fact, UsrX may have identical UCode with UsrA, but different HCode is arranged, and in order to distinguish the log messages of UsrA and UsrX, avoids ambiguity to take place, and when UsrA login HSvr-A, usually, the HCode of UsrA partly is also contained in the login account.In the middle of the reality, the user uses for convenience, HSvr can be according to the HCode situation that has of oneself, and with user's relevant agreement, when allowing the user to login in some cases, disappearance HCode partial information, at this moment, HSvr further analyzes the HCode of corresponding disappearance, is used for improving this user's GUID.
For example, do not comprise the HCode part of UsrA in the log messages, then, after HSvr-A received this log messages, which HCode the HCode that be able to analyze disappearance was actually, otherwise, think that the number of the account that UsrA provides has ambiguity, and produce unusual.Also for example, if HSvr-A has only a HCode, for example, have only QQ, do not have 99 and qq.com, then during the UsrA login, can lack the HCode part of GUID in log messages, HSvr-A is with the HCode of QQ as disappearance.Also for example, the HCode of acquiescence is set, for example 99, when having lacked the HCode part in the log messages of UsrA, HSvr-A uses the HCode of acquiescence as the HCode of disappearance.Also for example, agreement is used when posting location type GUID login, and the HCode part must be provided, so, if do not comprise the HCode part in the log messages, that then think the log messages correspondence is the GUID of a MsC type, at this moment, choose the IBC of an acquiescence as the HCode of this disappearance; Perhaps, HSvr-A has only an IBC, for example, has only QQ, does not have 99, then directly with the HCode of QQ as disappearance; Perhaps, several IBC of HSvr correspondence are of equal value, for example, Tengxun with 99 and QQ as the IBC of equivalence, like this, can select any one GUID as disappearance among the IBC of several equivalences.Two HCode equivalences refer to that identical UCode under these two HCode always identifies same user.
Equally, the ToUsr in the above-mentioned message or FromUsr part are when having lacked corresponding HCode, and which HCode the HCode that the HSvr of reception message or subscription client will be able to analyze disappearance is actually, thereby avoids ambiguity to take place.For example, send message between the user in the same IMS, in the message, during ToUsr excalation HCode, use the HCode of FromUsr as the HCode of this ToUsr.
In the narration of back of the present invention, so that { in the log messages, the login account number is that GUID is example; In the above-mentioned message format, ToUsr is purpose user GUID, and FromUsr is source user GUID } be example, but be not used in restriction the present invention.
In step 102, HSvr-A can connect by the SS that sets up, and sends corresponding message to HSvr-B.HSvr-A can determine the HSvr of UsrB ownership according to the GUID of UsrB, i.e. the host IP address of HSvr-B, and the port numbers by this IP address and agreement, and for example unified agreement 1868 is connected to HSvr-B, connects thereby set up SS.Connect by this SS, the message that HSvr-A will carry the GUID of UsrB sends to HSvr-B.And in the step 103, HSvr-B can also transmit a reply message to HSvr-A by this connection, the mechanism of for example taking to block is handled the message of receiving, add the sign that connects perhaps for the message of receiving, be put in the message queue, and when handling this message, determining to transmit a reply message the connection that will use according to the sign that is inserted into the connection in the message, the present invention below will introduce the stronger processing mode of autgmentability.
In fact, in the operating environment that interconnects normally, information interaction between two HSvr may be very frequent, therefore, when HSvr-A is connected to HSvr-B, sent corresponding request, and after receiving relevant response, this connection does not need to disconnect, and comes from the request of HSvr-B so that receive, or sends new request to HSvr-B.In this case, preferably, HSvr preserves the corresponding relation that HCode is connected with SS, so that when sending message between HSvr, determines the required SS connection of passing through of the described message of transmission according to the HCode of addressing purpose GUID in the message.For example, the corresponding relation that HCode is connected with SS is saved in the table 5.
Table 5
HCode SS connects Remark
163.com The SktD of SS1 HSvr-B
yeah.net The SktD of SS1 HSvr-B
Hotmail.com The SktD of SS2 HSvr-C
live.com The SktD of SS2 HSvr-C
163 The SktD of SS1 HSvr-B
352 The SktD of SS2 HSvr-C
MSN The SktD of SS2 HSvr-C
WY The SktD of SS1 HSvr-B
Like this, in step 102, HSvr-A judges whether UsrB belongs to oneself after receiving message from UsrA, if, then directly according to the GUID of UsrB, determine that corresponding CS connects, connect by this CS, described message is sent to UsrB.If UsrB does not belong to oneself, then from the HCode shown in the table 5 and corresponding relation that SS connects, determine corresponding SS connection according to the HCode of UsrB, the message that connects the GUID that will carry UsrB by this SS sends, namely send to corresponding HSvr, for example, the SktD that connects with the SS that determines uses send () function as parameter, and the message of having carried the GUID of UsrB is sent.
HSvr-A also can be according to the corresponding relation of described HCode and HSvr, the host IP address of the HCode correspondence of the UsrB that obtains, and judge whether it is the IP address of oneself, if then UsrB belongs to oneself, otherwise do not belong to oneself.
Preferably, HSvr-A preserves one's own relevant HCode in advance, and HSvr-A judges whether the HCode of UsrB is had by own, if then UsrB belongs to oneself, otherwise does not belong to oneself.
Of particular note, the corresponding relation that described HCode is connected with SS is actually a kind of special shape of the corresponding relation of HCode and HSvr, i.e. opposite end HSvr(PeerHSvr, Peer HSvr) relevant SS connects the corresponding relation with HCode.Therefore, in the middle of the reality, corresponding relation according to described HCode and HSvr, the perhaps one's own relevant HCode that preserves in advance, HSvr-A can add some special records in table 5, the HCode of described special record is had by HSvr-A oneself, and corresponding SS is connected to a certain particular value, for example-100.As show shown in the 5-1:
Table 5-1
HCode SS connects Remark
163.com The SktD of SS1 HSvr-B
qq.com -100 null
yeah.net The SktD of SS1 HSvr-B
Hotmail.com The SktD of SS2 HSvr-C
live.com The SktD of SS2 HSvr-C
99 -100 null
163 The SktD of SS1 HSvr-B
352 The SktD of SS2 HSvr-C
MSN The SktD of SS2 HSvr-C
QQ -100 null
WY The SktD of SS1 HSvr-B
Like this, in step 102, after HSvr-A receives message from UsrA, from the HCode shown in the table 5-1 and corresponding relation that SS connects, determine corresponding SS connection according to the HCode of UsrB, judge whether the SS connection of described correspondence is-100, if, the GUID that UsrB then is described belongs to oneself, then directly according to the GUID of UsrB, determine that corresponding CS connects, and sends to UsrB with described message; If it is not-100 that the SS of described correspondence connects, then, the message that connects the GUID that will carry UsrB by this SS sends to corresponding HSvr.
Among the HSvr, in HCode as shown in table 5 and the mapping table that SS is connected, corresponding SS connects according to the C/S type that connects and is divided into two kinds: PHoSS type and PHoCS type.
In the middle of the reality, the also C/S type that can connect according to SS, with table 5 separated into two parts, that is, and the mapping table that HCode is connected with the PHoSS type, the mapping table that HCode is connected with the PHoCS type.
Certainly, in order to improve retrieval rate, can also HCode be saved in respectively in the different tables with the corresponding relation that SS connects according to dissimilar HCode.
For example, Tengxun, Netease and Microsoft can reach the IMS interconnection agreement, and issue one's own HCode respectively, like this, Tengxun can be according to the HCode of issue, according to the corresponding relation of described HCode and HSvr, obtain the host IP address of corresponding HSvr, perhaps according to the HCode of issue, obtain corresponding HDomain, obtain the host IP address of corresponding HSvr by operations such as domain name mappings.Set up SS with these HSvr respectively and be connected, and according to the corresponding relation of described HSvr and HCode, set up the corresponding relation that HCode as shown in table 5 is connected with SS.
Also for example, Tengxun arranges a relevant HSvr description document in advance in HSvr-A, in this document, each HSvr is arranged, for example HSvr-B and HSvr-C etc., host IP address, and the HCode that has of corresponding HSvr.When HSvr-A starts, load this document, each HSvr in this document, carry out following process one by one:
Step 11, from described HSvr description document, read the host IP address of this HSvr, with and the HCode that has.
The host IP address that step 12, basis read, foundation is connected with the SS of this HSvr.
Step 13, according to the HCode of this HSvr correspondence, in table 5, set up the corresponding relation that these HCode are connected with this SS.
Like this, just can carry out initial configuration according to described HSvr description document his-and-hers watches 5.
Equally, the HSvr-B of Netease also comes initial table 5 according to the processing mode of the HSvr-A of Tengxun.Like this, Tengxun and Netease will set up two SS and be connected:
Have two towards the socket of HSvr-B in HSvr-A: 1, HSvr-A is as the TCP server, intercepts the connection request that HSvr-B initiates and set up TCP when connecting and the PHoSS that creates; 2, HSvr-A is as the TCP client, when initiating connection request and setting up TCP to connect to HSvr-B and the PHoCS that creates.In this case, preferably, HSvr-A sends message by described PHoCS to HSvr-B by the message of described PHoSS reception from HSvr-B.
Have two towards the socket of HSvr-A in HSvr-B: 1, HSvr-B is as the TCP server, intercepts the connection request that HSvr-A initiates and set up TCP when connecting and the PHoSS that creates; 2, HSvr-B is as the TCP client, when initiating connection request and setting up TCP to connect to HSvr-A and the PHoCS that creates.In this case, preferably, HSvr-B sends message by described PHoCS to HSvr-A by the message of described PHoSS reception from HSvr-A.
Because TCP connects and can be used for two-way communication, therefore, HSvr-A and HSvr-B only need set up a TCP and be connected and can carry out information interaction.For example, HSvr-A initiates connection request at the host IP address according to a HSvr to this HSvr, set up with before the SS of this HSvr is connected, can also further judge whether to have set up with the SS of this HSvr and be connected, if, then in table 5, set up the corresponding relation that this SS connects the HCode that has with this HSvr, finish then.For example, HSvr-A searches the peer IP address PHoSS identical with the host IP address of described this HSvr that reads from each PHoSS that creates, judge whether to find, if find, then in table 5, set up the corresponding relation that this SS connects the HCode that has with this HSvr, finish then.Handle if HSvr-B also pacifies according to this mode, then, between HSvr-A and HSvr-B, only set up a SS and connect.
Above-mentioned is the process of static configuration table 5.In the middle of the reality, the whole world has the SP of HSvr may be a lot, and other HSvr of a required connection of HSvr normally changes, or even uncertain, and the HCode that HSvr has also may change.Therefore, preferably, come corresponding relation data in the admin table 5 by the mode of Dynamic Maintenance.For ease of operation maintenance, introduce the method for HSvr dynamic and intelligent allocation list 5 below.
Described dynamic and intelligent allocation list 5 refers to, when execution is searched the operation of corresponding SS connection according to a HCode from table 5, connects if find corresponding SS, then carries out following three steps:
Step 31, according to the corresponding relation of this HCode according to described HCode and HSvr, obtain the host IP address of corresponding HSvr;
Step 33, be connected the HSvr of described correspondence according to the port numbers of the host IP address that obtains and agreement, set up towards the SS of the HSvr of described correspondence and connect;
Step 35, preservation are towards the SS connection of the HSvr of described correspondence and the corresponding relation of this HCode.For example, be kept in HCode as shown in table 5 and the mapping table that SS is connected.
Consider that a HSvr may have a plurality of HCode, therefore, before the execution in step 33, can also first execution in step 32: judge whether to exist towards the SS of the HSvr of described correspondence to connect, if, direct execution in step 35 then; Otherwise, ability execution in step 33.As shown in Figure 4, the corresponding relation flow chart that is connected with SS for dynamic-configuration HCode of the present invention.
If allowing to set up between two HSvr two SS connects, then described step 32 can further be step 32B: the IP address PHoCS identical with the host IP address that obtains in step 31 that searches opposite end HSvr from each PHoCS that creates, judge whether to find, if find, then thought this PHoCS correspondence and connected towards the SS of the HSvr of described correspondence, then direct execution in step 35; Otherwise, think not exist the SS towards the HSvr of described correspondence to connect execution in step 33.
In the middle of the reality, can obtain the peer IP address of this PHoCS correspondence according to the SktD of a PHoCS correspondence, for example obtain the IP address of described opposite end by getpeername () function.
For example, when HSvr-A will send a message to other HSvr, it is as follows that the mapping table that HCode as shown in table 5 is connected with SS carries out the process that dynamic and intelligent disposes:
Step 3101, HSvr-A are according to the addressing purpose of this message, and for example, the indicated HCode of the ToUsr of message searches corresponding SS and connects from table 5, if find, then connect by this SS described message is sent, and finish then; Otherwise, execution in step 3102.
Step 3102, according to the corresponding relation of indicated HCode according to described HCode and HSvr, obtain the host IP address of corresponding HSvr; Search the PHoCS that peer IP address is the described host IP address that obtains from each PHoCS, see whether there is corresponding PHoCS, if exist, then execution in step 3103; Otherwise, execution in step 3104.
3103, indicated HCode is saved in the table 5 with the corresponding relation that the corresponding SS of the PHoCS that finds is connected; And by this SS connection, described message is sent, finish then.
The host IP address that step 3104, basis obtain and the port numbers of agreement, for example 1868, the HSvr that connects described correspondence connects to set up towards the SS of the HSvr of described correspondence, and the corresponding relation that newly-established SS is connected with indicated HCode is saved in the table 5; And by newly-established SS connection, described message is sent.
Like this, just can carry out the dynamic and intelligent configuration to the mapping table that HCode as shown in table 5 is connected with SS.
Also for example, the GUID of UsrB is zhangliao@163.com, the mapping table that the HCode as shown in table 5 of HSvr-A is connected with SS still is an empty table, does not perhaps wherein have the record about 163.com, so, in step 102, be 163.com when not having corresponding SS to connect in table 5 when HSvr-A finds the HCode of UsrB, HSvr-A finds corresponding HSvr according to the corresponding relation of 163.com according to described HCode and HSvr, be HSvr-B, host IP address.Search each PHoCS according to the host IP address of HSvr-B, see that can find peer IP address be the PHoCS of the host IP address of HSvr-B, if find, then direct corresponding relation with the corresponding SS connection of this PHoCS and 163.com adds in the table 5.If do not find corresponding PHoCS, then according to the host IP address of HSvr-B and the port numbers of agreement, set up the SS connection towards HSvr-B, newly-established SS connection and 163.com corresponding relation are added in the table 5.Connect or described newly-established SS connection by the corresponding SS of the described PHoCS that finds, the message of having carried zhangliao@163.com is sent, namely send to HSvr-B.
Equally, HSvr-B also preserves the mapping table that HCode as shown in table 5 is connected with SS, and, when initialization, table 5 can be initialized as empty table.HSvr-B is when sending message to HSvr-A, and for example UsrY sends SMS message to UsrA by HSvr-B, and so, HSvr-B can come his-and-hers watches 5 to carry out the dynamic and intelligent configuration according to above-mentioned HSvr-A to the processing mode that oneself sends message according to the addressing purpose of message.
According to the processing mode of step 32B, may set up double T CP between HSvr-A and the HSvr-B and connect, that is:
Have two towards the socket of HSvr-B in HSvr-A: 1, HSvr-A is as the TCP server, intercepts the connection request that HSvr-B initiates and set up TCP when connecting and the PHoSS that creates; 2, HSvr-A is as the TCP client, when initiating connection request and setting up TCP to connect to HSvr-B and the PHoCS that creates.In this case, preferably, HSvr-A sends message by described PHoCS to HSvr-B by the message of described PHoSS reception from HSvr-B.
Have two towards the socket of HSvr-A in HSvr-B: 1, HSvr-B is as the TCP server, intercepts the connection request that HSvr-A initiates and set up TCP when connecting and the PHoSS that creates; 2, HSvr-B is as the TCP client, when initiating connection request and setting up TCP to connect to HSvr-A and the PHoCS that creates.In this case, preferably, HSvr-B sends message by described PHoCS to HSvr-A by the message of described PHoSS reception from HSvr-A.
In this case, for a HSvr, the corresponding relation of the actual HCode of being of the corresponding relation that described HCode is connected with SS and PHoCS.
Because TCP connects and can be used for two-way communication, therefore, HSvr-A and HSvr-B only need set up a TCP and be connected and can carry out information interaction.If only allowing to set up between two HSvr a SS connects, then, described step 32 further is step 32C: search peer IP address PHoCS or the PHoSS identical with the host IP address that obtains from each PHoCS of creating and PHoSS in step 31, judge whether to find, if find, then thought this PHoCS or PHoSS correspondence and connected towards the SS of the HSvr of described correspondence, then direct execution in step 35; Otherwise, think not exist the SS towards the HSvr of described correspondence to connect execution in step 33.
Like this, when the mapping table that HCode as shown in table 5 is connected with SS carries out the dynamic and intelligent configuration, can guarantee only to set up between HSvr-A and the HSvr-B TCP and connect.
Can by in table 5, increase the host IP address field record corresponding SS connect towards HSvr, like this, described step 32 can further be step 32D: according to the host IP address that obtains in step 31, searching corresponding SS from table 5 connects, if find, then explanation has existed towards the SS connection of the HSvr of described correspondence, then direct execution in step 35; Otherwise, think not exist the SS towards the HSvr of described correspondence to connect execution in step 33.
Can also preserve the last time by a SS connection transmission message, as shown in table 6.
Table 6
SS connects LastTime Remark
The SktD of SS1 SS towards HSvr-B connects
The SktD of SS2 SS towards HSvr-C connects
Like this, HSvr can arrange a scan operation, the record in the traversal list 6 regularly or randomly, judge whether the LastTime value surpasses default value apart from the current time, 24*3600 second for example is if then disconnect the corresponding SS of this record and connect, this record of deletion from table 6, and this SS of deletion connects all corresponding records from table 5.Like this, just can keep the automatic growth and decline of table 5, thereby allow HSvr reach the optimum operation pattern according to the variation of traffic carrying capacity.
In this case, when the SS of a PHoCS type of every establishment connected, all SktD and the current time that connects according to this SS produced a new record, and this new record is added in the table 6.
For example, the GUID of UsrB is zhangliao@163.com, in step 102, HSvr-A is when selecting corresponding SS to connect according to 163.com from table 5-2, determine that corresponding SS connects, for example SS1 connects, and the message of having carried zhangliao@163.com is connected by SS1 send; Then according to SS1 connection and locating table 6, the lastTime time of the record that finds is set to the current time.
Certainly, in the above-mentioned table 5, also can increase a LastTime field, select a SS to connect the time that sends IUsr message in order to record for the last time according to corresponding HCode, shown in table 5-2.
Table 5-2
HCode SS connects LastTime Remark
163.com The SktD of SS1 HSvr-B
yeah.net The SktD of SS1 HSvr-B
Hotmail.com The SktD of SS2 HSvr-C
live.com The SktD of SS2 HSvr-C
163 The SktD of SS1 HSvr-B
352 The SktD of SS2 HSvr-C
MSN The SktD of SS2 HSvr-C
WY The SktD of SS1 HSvr-B
Like this, HSvr can arrange a scan operation, and regularly or randomly the record among the traversal list 5-2 judges whether the LastTime value surpasses default value apart from the current time, and for example 3600 seconds, if then delete this record.Like this, just can delete list 5-2 in those quiet records, reach the effect of the automatic growth and decline of maintenance table 5-2.
In this case, when increasing new record in table 5-2, the LastTime field of this new record is set to the current time.
For example, the GUID of UsrB is zhangliao@163.com, in step 102, HSvr-A is when selecting corresponding SS to connect according to 163.com from table 5-2, determine that corresponding SS connects, for example SS1 connects, and the lastTime time of all records of SS1 correspondence is set to the current time, and the message that then will carry zhangliao@163.com sends by the SS1 connection.
Need to prove, when actual enforcement is of the present invention, in above-mentioned each table, corresponding to the value of each SS link field, usually be the numbering that each HSvr internal distribution connects for this SS, for example, as SktD, or a pointer that points to this connecting object.For example, connect at this SS of SS1, the numbering of HSvr-A internal distribution is 123, and the numbering of HSvr-B internal distribution is 891, though HSvr-A distributes to the numbering difference that same SS is connected with HSvr-B, the two numbering by own internal distribution can be determined to same SS and connect.
In the present invention, the SS that HSvr obtains a GUID correspondence connects and refers to: according to the HCode of this GUID correspondence, according to the corresponding relation that described HCode is connected with SS, determine corresponding SS connection.The CS that HSvr obtains a GUID correspondence connects and refers to: according to this GUID, connect corresponding relation with IUsr according to the CS that sets up shown in table 3-1, determine that corresponding CS connects.
Set forth a local HSvr above, HSvr-A for example, to opposite end HSvr, HSvr-B for example, when sending message, when the GUID according to the purpose user carries out addressing, if from HCode as shown in table 5 and mapping table that SS connects, can't determine corresponding SS connection, then should adopt the dynamic and intelligent collocation method by this locality HSvr, dispose the mapping table that HCode as shown in table 5 is connected with SS automatically.
HSvr handles or exchanges the message between the user by one or more in the following operation:
Message is replenished (MC, Message Complement): after HSvr connects the message of receiving from client by CS, connect according to this CS, according to the corresponding relation of the CS connection of shown in table 3-1, setting up with corresponding IUsr, obtain source user, be sender of the message's GUID, with the FromUsr of this GUID updating message.
Message Processing (MsgProc, Message Processing): whether the ToUsr that judges message belongs to oneself, if then carry out HomeMsgProc operation cited below; Otherwise the SS that obtains the ToUsr correspondence connects, and connects by this SS described message is sent.
Ownership Message Processing (HomeMsgProc, Home Message Processing): the CS that obtains the ToUsr correspondence of message connects, and connects by this CS, and this message is sent.
Above-mentioned when communicating based on socket, describedly pass through a connection, for example CS connects or SS connects, a message is sent, refer to by the socket of this connection described message be sent, for example the socket descriptor according to this socket adopts send () or sendto functions such as () described message to be sent to the opposite end of this connection.
GUID with UsrA is sunquan#QQ below, and the GUID of UsrB is caocao@yeah.net, and the GUID of UsrX is zhouyu#99, and UsrA sends message to UsrB for the example explanation, and the processing procedure that sends message to UsrX.
In this example, three users are connected to the HSvr that oneself belongs to separately, and successfully login.HSvr-A has set up SS with HSvr-B and has been connected.
UsrA sends message content to UsrB and is " support firmly prime minister and send forces to suppress random crafty Liu fully ", and process is as follows:
At first, UsrA is as follows to HSvr-A transmission message:
ToUsr?=?caocao@yeah.net,FromUsr?=?null,
MsgCode=ShortMsg, MsgContent=" support firmly prime minister and send forces to suppress random crafty Liu fully "
After HSvr-A receives above-mentioned message from UsrA, carry out the MC operation earlier, obtain following message:
ToUsr?=?caocao@yeah.net,FromUsr?=?sunquan#QQ,
MsgCode=ShortMsg, MsgContent=" support firmly prime minister and send forces to suppress random crafty Liu fully "
HSvr-A then carries out the MsgProc operation.
When carrying out the MsgProc operation, because the HCode of the ToUsr of message is domain name yeah.net, belong to HSvr-B, therefore, the SS of the ToUsr correspondence by this message of obtaining connects, and sends described message to HSvr-B.
HSvr-B receives the described message that HSvr-A sends, and directly carries out the HomeMsgProc operation: the CS that obtains the caocao@yeah.net correspondence connects, and connects by this CS, and this message is sent, and is received by UsrB.
HSvr-B can also further transmit a reply message to HSvr-A, whether sends success to inform message.For example:
HSvr-B constructs return information, and the MsgCode of this answer message is set to the answer message code ResShortMsg of message code ShortMsg correspondence, and the MsgContent value is set to 1, and expression sends successfully; The ToUsr of this return information is set to sunquan#QQ, and the FromUsr of this return information is set to caocao@yeah.net.Described answer message is as follows:
ToUsr?=?sunquan#QQ,FromUsr?=?caocao@yeah.net,
MsgCode?=?ResShortMsg,MsgContent?=?“1”
HSvr-B connects by the SS of the ToUsr correspondence of described answer message, and described return information is sent to HSvr-A.HSvr-B can be according to the HCode of the ToUsr correspondence of described answer message, determines that corresponding SS connects from HCode as shown in table 5 and mapping table that SS is connected.
After HSvr-A received described answer message, the CS that obtains the ToUsr correspondence of answer message connected, and connects by this CS, should reply message and send.
UsrA sends message content to UsrX and is " must in Chibi one band surround and annihilate Cao Jun ", and process is as follows:
It is as follows that UsrA sends message to HSvr-A:
ToUsr?=?zhouyu#99,FromUsr?=?null,
MsgCode=ShortMsg, MsgContent=" must be in Chibi one band surround and annihilate Cao Jun "
After HSvr-A receives above-mentioned message from UsrA, carry out the MC operation earlier, obtain following message:
ToUsr?=?zhouyu#99,FromUsr?=?sunquan#QQ,
MsgCode=ShortMsg, MsgContent=" must be in Chibi one band surround and annihilate Cao Jun "
HSvr-A then carries out the MsgProc operation.
When carrying out the MsgProc operation, because the HCode of the ToUsr of message is IBC value 99, belong to HSvr-A, therefore, the CS that obtains the zhouyu#99 correspondence connects, and connects by this CS, and this message is sent.
Equally, HSvr-A can also further transmit a reply message to UsrA, whether sends success to inform message.For example:
HSvr-A constructs return information: the MsgCode that should reply message is set to ResShortMsg, the MsgContent value is set to 1, expression sends successfully, and the ToUsr of this answer message is set to sunquan#QQ, and the FromUsr of this answer message is set to zhouyu#99.The answer message that produces is as follows:
ToUsr?=?sunquan#QQ,FromUsr?=?zhouyu#99,
MsgCode?=?ResShortMsg,MsgContent?=?“1”
HSvr-B connects by the CS of the ToUsr correspondence of described answer message, should reply message and send.HSvr-B can determine that from the online user's information table shown in table 3-1 corresponding CS connects according to the ToUsr of described answer message.
By the way, UsrA can also send the link information (for example IP address, port etc.) of oneself, perhaps out of Memory to UsrB.
According to the same manner, UsrB can send short message or out of Memory, for example link information to UsrA.Like this, just realized the information interaction of striding IMS of UsrA and UsrB.
Equally, UsrA and UsrB can carry out file interaction in this way, or even the audio or video information interaction.
For the ease of understanding, adopted general message format above, in the middle of the reality, the message that client sends to server can not have the FromUsr part.Equally, server sends to client's message, can not have the ToUsr part.Do like this, though can save limited message traffic, in the practical application, tend to the extensibility of attention location system more.
When above-mentioned UsrA and UsrB carried out information interaction, corresponding message was to transmit communication mode (abbreviation pass-through mode) according to message, transmits by HSvr-A and HSvr-B.In the middle of the reality, UsrA and UsrB also can directly communicate, and for example, communicate by the UDP message bag, perhaps, communicate after TCP connects by setting up.
In fact, after UsrA obtains the IP address of UsrB, can be according to the port numbers of this IP address and agreement, for example 1891, initiate connection request, UsrB receives this connection request, establishes a communications link with UsrA (the present invention claims client to be connected to the CC that is connected to of client).Connect by this CC, UsrA and UsrB carry out the mutual of literal or information such as voice or video.
UsrA can send message request to UsrB by HSvr-A when UsrB sets up CC and is connected, and by this message, HSvr-A sends to UsrB with the IP address of UsrA.Like this, UsrB just can receive the IP address of UsrA from HSvr-B.Simultaneously, UsrB is receiving the UsrA connection request, further parse source IP address from request message, the IP address of the UsrA that UsrB receives by more described source IP address with from HSvr-B judges whether connection request is credible, and namely whether the source client is consistent with source IUsr, if the two unanimity, illustrate that connection request is credible, otherwise, illustrate that connection request is not that UsrA sends, like this, UsrB just can refuse this connection request.
By resolving the source IP address of the message bag that receives, HSvr-A can obtain the IP address of UsrA when UsrA logins, also can obtain the IP address of UsrA when UsrA sends described invitation message.
For example UsrA can carry out to the IP address that UsrB sends oneself as follows by invitation message:
It is as follows that UsrA sends message to HSvr-A:
ToUsr?=?caocao@yeah.net,FromUsr?=?null,
MsgCode?=?Invite,MsgContent?=?null
After HSvr-A receives above-mentioned message from UsrA, carry out the MC operation, and when judging that MsgCode is Invite, the IP address of the UsrA that obtains is filled up among the MsgContent, thereby, obtain following message:
ToUsr?=?caocao@yeah.net,FromUsr?=?sunquan#QQ,
MsgCode=Invite, the IP address of MsgContent=UsrA
HSvr-A then carries out the MsgProc operation, so that this message is sent to HSvr-B.Here, when carrying out the MsgProc operation, because the HCode of the ToUsr of message is domain name yeah.net, belong to HSvr-B, therefore, the SS of the ToUsr correspondence by this message of obtaining connects, and sends described message to HSvr-B.
HSvr-B receives the described message that HSvr-A sends, and directly carries out the HomeMsgProc operation: the CS that obtains the caocao@yeah.net correspondence connects, and connects by this CS, and this message is sent, and is received by UsrB.
Like this, UsrB just obtains inviter's real IP address from the HSvr that oneself belongs to, thereby prevents address spoofing.
In the middle of the reality, HSvr can also preserve the buddy list (Blist, Buddy List) of IUsr, when server is logined or is published at an IUsr, according to this Blist, with the state information of this IUsr, state such as online, off-line for example sends to its online good friend's client.HSvr also sends to this IUSR with good friend's relevant information of this IUSR.Good friend's relevant information generally comprises good friend's state information, and/or good friend's link information, etc.
For example, if certain good friend is the UsrX of this IMS among the Blist of UsrA, so, when the state information of UsrA changed, if UsrX is online, then, HSvr-A directly sent to the status message of UsrA the client of UsrX.
If certain good friend is the UsrB among other IMS among this Blist, so, after UsrA logins, HSvr-A sends to HSvr-B with the presence message of UsrA, if adopt above-mentioned common message format, then, in the message, ToUsr is the GUID of UsrB, and FromUsr is the GUID of UsrA, and MsgCode is Presense, represent that this message is to present message, MsgContent is Status Flag (for example, 1 expression is online, 0 expression off-line); After HSvr-B receives this status message, when UsrB is online, this status message is sent to UsrB, and sending the answer message of the state information contain UsrB to HSvr-A, in the message, MsgCode is ResPresense, represent that this message is to the above-mentioned answer that presents message, MsgContent is Status Flag, and the ToUsr of message is the GUID of UsrA, and FromUsr is the GUID of UsrB; HSvr-A sends it to UsrA after receiving this answer message.
HSvr-A is the state of registration UsrB in the Blist of UsrA further, and when the UsrA off-line, then, for the UsrB among described other IMS, HSvr-A just sends to UsrB with this deferred information when judging that UsrB is online.
In the middle of the reality, no matter whether UsrB logins HSvr-B, and UsrA can send message to UsrB.HSvr-B is receiving UsrA when sending to the message of UsrB, if find that UsrB does not login as yet, then HSvr-B will preserve this message temporarily, and after UsrB logins, again this message be sent to UsrB.This message generally is some deferred informations, and such as the off-line short message, off-line files transmits, etc.
UsrA or UsrB can by above-mentioned pass-through mode with oneself the IP address and port numbers by the modes such as answer message of session invitation message for example or session invitation message, send to the other side.For example, also can be when receiving the address request that UsrA sends, to carry out with the IP address of UsrB, operation that port numbers sends to UsrA, for example UsrA initiates voice or video session request by above-mentioned pass-through mode to UsrB, after HSvr-B receives this request, this request is sent to UsrB, and reply (but not refusal) at UsrB after, information such as the IP address of UsrB, port numbers are sent to UsrA.Perhaps, UsrB initiates voice or video session is invited by described pass-through mode to UsrA, and has directly carried the information such as IP address, port numbers of oneself in this invitation message.
Perhaps, UsrA or UsrB by server registers its IP address and port numbers, and send to relevant online good friend by server according to its Blist when logining server.For example, when HSvr-B logins at UsrB, registered IP address and the port numbers of UsrB, among the Blist of UsrB UsrA has been arranged, like this, HSvr-B just sends to UsrA with information such as the IP address of UsrB, port numbers by HSvr-A.With the IP address of UsrB, operation that port numbers sends to UsrA can be HSvr-B receive UsrA that HSvr-A sends online present message after carry out, for example be the answer message of ResPresense by MsgCode, the state that sends UsrB to UsrA is presence, and carries the information such as IP address, port numbers of UsrB in this answer message.
UsrA or UsrB are obtaining the other side's IP address and port numbers, just can set up TCP/IP with the other side and be connected and communicate, and perhaps communicate by the UDP message bag.Like this, the two just can directly carry out literal, file, voice or video interactive or session.Be among the same IMS as UsrA and UsrB.
Among present most of IMS, the user generally is from the user list that client shows, selects an online user to carry out literal, voice or video interactive.In fact, for the UsrC among the SP-C, if UsrC is not in the Blist of UsrA, UsrA also can allow client know purpose IUsr, thereby send message to UsrC by the address information at client input UsrC, and obtain attributes such as the IP address of UsrC and port numbers, and and then initiate literal or voice or video session request, after meeting with a response and having set up CC and connect, just can connect to carry out corresponding session by the CC of foundation.
The present invention also proposes a kind of cross-domain CC and connects method for building up, and by this method, UsrA can set up CC safely with UsrB and be connected.
Specifically, this method comprises the steps:
Step 601, source client will comprise that the message request of purpose IUsr information sends to the HSvr of source IUsr ownership, i.e. source HSvr.
The IP address that step 602, described source HSvr obtain source IUsr will comprise that the invitation message of the good purpose IUsr of GUID of IP address, the source IUsr of described source IUsr sends to the HSvr of described purpose IUsr ownership, i.e. purpose HSvr.
Step 603, described purpose HSvr obtain the IP address of described purpose IUsr; The IP address of described purpose IUsr is replied to source HSvr, should reply message by source HSvr and send to described source client, described source client receives described answer message; Described invitation message is sent to purpose IUsr clients corresponding.
Step 604, described source client are initiated connection request according to the IP address of the purpose IUsr that receives to the purpose client.
Step 605, described purpose client are obtained the peer IP address of described connection request, judge whether this IP address is the IP address of source client described in the described invitation message, if then accept connection request, and set up the CC connection.
Described step 604 also can be: described purpose client is initiated connection request according to the IP address of the source IUsr that receives to the source client.Correspondingly, described step 605 is: described source client is obtained the peer IP address of described connection request, judges whether this IP address is the IP address of purpose client described in the described answer message, if then accept connection request, and set up the CC connection.
A client is when receiving the connection request of other TCP client, or during the UDP message bag, the IP address of opposite end can be obtained by resolving corresponding IP protocol header, by resolving corresponding Transmission Control Protocol head or udp header, the port numbers of opposite end can be obtained.For example, use the socket technology, HSvr can obtain IP address and the port numbers of TCP client by accept () function when accepting connection request.
Top step 601 to step 603 has been finished the address exchange of source client and purpose client, and step 604 to step 605 has been finished operations such as connection request initiation, connection request checking and foundation.
For example: it is as follows that UsrA sends invitation message to HSvr-A:
ToUsr?=?caocao@yeah.net,FromUsr?=?null,
MsgCode?=?Invite,MsgContent?=?null
After HSvr-A receives above-mentioned message from UsrA, carry out the MC operation, and when judging that MsgCode is Invite, the IP address of the UsrA that obtains is filled up among the MsgContent, thereby, obtain following message:
ToUsr?=?caocao@yeah.net,FromUsr?=?sunquan#QQ,
MsgCode=Invite, the IP address of MsgContent=UsrA
HSvr-A then carries out the MsgProc operation, so that this message is sent to HSvr-B.Here, when carrying out the MsgProc operation, because the HCode of the ToUsr of message is domain name yeah.net, belong to HSvr-B, therefore, the SS of the ToUsr correspondence by this message of obtaining connects, and sends described message to HSvr-B.
HSvr-B receives the described message that HSvr-A sends, the IP address that obtains the caocao@yeah.net correspondence according to the GUID of UsrB is connected with CS, the IP address that obtains is sent to HSvr-A by replying message, and connect by this CS, this invitation message is sent, received by UsrB.
Described answer message is as follows:
ToUsr?=?sunquan#QQ,FromUsr?=?caocao@yeah.net,
MsgCode=ResInvite, the IP address of MsgContent=UsrB
After HSvr-A receives described answer message, according to this destination address sunquan#QQ that replys message, should reply message and send to UsrA.Like this, UsrA just obtains the IP address of UsrB.
By the aforesaid operations process, finished the address exchange of UsrA and UsrB.
After UsrB receives the IP address of UsrA, initiate connection request to UsrA.When UsrA receives this connection request, obtain the peer IP address of connection request, judge whether this IP address is the IP address of carrying in the above-mentioned answer message, if then accept request, and set up the CC connection, thereby set up session.
Certainly, also can be to initiate connection request to UsrB after UsrA receives the IP address of UsrB.Like this, when UsrB receives this connection request, obtain the peer IP address of connection request, judge whether this IP address is the IP address of carrying in the above-mentioned invitation message, if then accept request, and set up the CC connection, thereby set up session.
Mention above, it can be the reliable connection of setting up by Transmission Control Protocol that described SS connects.In fact, to connect also can be the insecure virtual connection of setting up by udp protocol for described SS.Like this, local HSvr still can be by correspondence the socket descriptor of socket identify this virtual connection, thereby set up the corresponding relation of this virtual connection and HCode, addressing when sending to be used for data, and the dynamic and intelligent of the corresponding relation that the HCode shown in the above-mentioned table 5 is connected with SS disposes.Local HSvr can obtain IP address and the port numbers of opposite end HSvr by the UDP datagram that parsing is received from opposite end HSvr.
Certainly, after obtaining the IP address of opposite end HSvr, also can identify described connection with this IP address, thereby set up the corresponding relation of this IP address and corresponding HCode, also namely in table 5, that the SS link field is deposited is not the SktD that corresponding SS connects, but the IP address of the opposite end HSvr that should connect.
It also can be the insecure virtual connection of setting up by udp protocol that described CS connects.Like this, HSvr still can be by correspondence the socket descriptor of socket identify this virtual connection, thereby set up the corresponding relation of this connection and the GUID of corresponding IUsr, determine that with the GUID according to corresponding IUsr corresponding CS connects, carry out the transmission of message, perhaps, connect according to the CS of correspondence and to obtain corresponding GUID, carry out message and replenish.HSvr can obtain IP address and the port numbers of this IUsr by the UDP datagram that parsing is received from IUsr.
Certainly, after obtaining client ip address, also can identify described connection with this IP address, thereby set up the corresponding relation of this IP address and corresponding GUID, for example, preserve user's online information by online user's information table as described in Table 3.
The present invention also provides a kind of HSvr, reference when implementing communication means of the present invention for the technical staff.
A kind of HSvr comprises central processing module, communication access module, memory module.As shown in Fig. 5 frame of broken lines.
Described communication access module is used for the access communications network, carries out information interaction with client; Described communication access module also is used for setting up being connected with the SS of other HSvr, connects with described other HSvr by the SS that sets up and carries out information interaction.
Described storage module is used for preserving the corresponding relation that HCode is connected with SS.
Message for the GUID that comprises the purpose user that receives, central processing module is according to the HCode of purpose user in the message, according to the HCode that sets up and the corresponding relation of HSvr, judge whether this purpose user belongs to oneself, if then directly this message is sent to this purpose user clients corresponding; Otherwise, will comprise that the message of this purpose user's GUID connects and sends by being connected SS that corresponding relation determines according to described purpose user's HCode with SS according to described HCode, by opposite end HSvr this message is sent to this purpose user client.
Described memory module is preserved the corresponding relation of HCode and HSvr, and central processing module obtains a HSvr that HCode is corresponding according to the HCode of described preservation with the corresponding relation of HSvr.
Perhaps, described communication access module be connected to setting preservation the corresponding relation GUIDAS of described HCode and HSvr, as shown in Figure 6.Central processing module obtains the HSvr of a HCode correspondence by visit GUIDAS.
Perhaps, described central processing module is set up the corresponding relation of HCode and HSvr by the domain name constructing module is set, and by the domain name constructing module that arranges, obtains the HDomain of a HCode correspondence, and this HDomain points to corresponding HSvr.
The corresponding relation of described HCode and HSvr is the corresponding relation of the host IP address of HCode and HSvr.The described HSvr that obtains a HCode correspondence refers to obtain the host IP address of this HCode correspondence.
Perhaps, central processing module obtains the HDomain of a HCode correspondence by the domain name constructing module of setting.According to this HDomain, by domain name mapping, for example visit DNS, obtain corresponding host IP address.
Central processing module is according to the corresponding relation of described HCode and HSvr, and indication communication access module is set up SS with other HSvr and is connected; Also preserve the corresponding relation that described other the corresponding HCode of HSvr is connected with the SS of described foundation at described storage device.
Described storage device is used for preserving the HCode that HSvr has, and central processing module judges according to the HCode that the HSvr that preserves has whether a GUID belongs to oneself.
Described central processing module is handled the message that comes from the access module of communicating by letter, comprise the ending message flow process, perhaps, selecting corresponding CS connection or SS to connect message or the amended message that will newly produce sends, perhaps, selecting corresponding CS connection or SS to connect forwards former message.
Described foundation is connected with the SS of other HSvr, and central processing module is connected to opposite end HSvr by the communication access module, sets up to be connected with the SS of described opposite end HSvr.For example, central processing module can be when the purpose HSvr to a HCode appointment sends message, judges when foundation is connected with the SS of this purpose HSvr as yet, and as the opposite end HSvr that connects, execution is set up and is connected with the SS of this opposite end HSvr with this purpose HSvr.Central processing module is according to this HCode, obtains the host IP address of this opposite end HSvr according to the corresponding relation of the HCode of described foundation and HSvr, and according to the host IP address that obtains, and sets up to be connected with the SS of this opposite end HSvr.
It can be to finish by the UDP message bag that described and client is carried out information interaction.In the middle of the reality, described communication access module also is used for receiving the client connection request, sets up to be connected with the CS of client; Described and client are carried out information interaction and can also be connected by the CS that sets up and finish.
Described storage module also is used for preserving the corresponding relation that IUsr is connected with CS.
Belong to the answer message of oneself for destination address, central processing module can be directly according to the destination address in this message, connect and the definite corresponding CS connection of the corresponding relation of IUsr according to the CS that preserves, connect by the CS that determines, should reply message and send to corresponding client.
Further, described memory module is also preserved user account information, and according to described user account information, described central processing module is verified the logging request that connects the IUsr that receives by CS, and after checking is passed through, preserve the corresponding relation that this IUsr is connected with corresponding CS.For example, for the login request message that comprises login user GUID and login password from client, central processing module is according to this GUID, from the account information table of preserving, obtain the corresponding password of preserving, whether the password of judging login password and preservation is consistent, for example whether equate, if then return login success message to client.Described login request message is to send after the CS that client-requested is set up connects foundation, central processing module is preserved the data of the corresponding relation that corresponding relation that this GUID is connected with this CS is connected with CS as described IUsr in memory module after login request message checking is passed through.
Further, central processing module also obtains IP address and/or the port numbers of logging on client, and after login authentication is passed through, further preserve and comprise the IP address that obtains and/or the login relevant information of port numbers, for example, when client connects ownership clothes server, the IP address that obtains client is IP address, perhaps when client sends login request message, obtain the IP address of client, and after log messages checking is passed through, preserve this IP address according to the GUID of current login user, for example, by being set, online user message table preserves described login relevant information.
Further, for the registration message that comprises registered user GUID and account password from client, whether there has been this GUID in the central processing module judges account information table, if exist, then return registration failure, otherwise, in described account information table, create user account according to described registered user GUID and account password, and return the message that succeeds in registration to client.
Being preferred embodiment of the present invention only below, is not for limiting protection scope of the present invention.All in the spirit and principles in the present invention and so on, any modification of doing, improve, be equal to replacement etc. and all should be included within protection scope of the present invention.

Claims (10)

1. a communication means is characterized in that, sets up the corresponding relation of HCode and HSvr in advance, said method comprising the steps of:
A, client will comprise that the message of purpose GUID sends to the HSvr of ownership, i.e. local HSvr;
B, described local HSvr determine the HSvr of described purpose GUID ownership according to the corresponding relation of described HCode and HSvr, and namely opposite end HSvr will comprise that the message of purpose GUID sends to this opposite end HSvr;
C, described opposite end HSvr according to the purpose GUID in the message, send to this purpose GUID clients corresponding with this message after receiving message from described local HSvr.
2. method according to claim 1 is characterized in that, described local HSvr sets up SS with at least one opposite end HSvr and is connected, and preserves the corresponding relation of SS connection and HCode; Step b is described according to described purpose GUID, according to the corresponding relation of described HCode and HSvr, determines that opposite end HSvr refers to, according to the HCode of described purpose GUID, according to the corresponding relation of the SS connection of preserving with HCode, determines that corresponding SS connects; The described message that will comprise purpose GUID sends to this opposite end HSvr and refers to, connects by the SS that determines, will comprise that the message of purpose GUID sends.
3. the method for the corresponding relation that is connected with SS of a dynamic-configuration HCode is characterized in that, said method comprising the steps of:
A, HSvr are according to addressing purpose GUID, according to the corresponding relation of the SS connection of preserving with HCode, obtaining corresponding SS connects, judge whether to obtain, if can not get corresponding SS connects, then according to described addressing purpose GUID, obtain corresponding host IP address according to the HCode that sets up in advance with the corresponding relation of HSvr;
B, connect described opposite end HSvr according to this host IP address, set up SS and connect;
The SS connection that c, preservation obtain and the corresponding relation of the HCode of described addressing purpose GUID.
4. a message switching method is characterized in that, sets up the corresponding relation that HCode is connected with SS; Said method comprising the steps of:
A, according to the HCode of addressing purpose GUID in the message, the corresponding relation according to described HCode is connected with SS carries out addressing, obtains corresponding SS and connects;
B, connect by the SS that obtains described message is sent to opposite end HSvr.
5. verify source client and the conforming method of source IUsr for one kind, it is characterized in that, said method comprising the steps of:
A, purpose client are from the IP address of the HSvr reception sources IUsr correspondence of purpose IUsr ownership; The connection request of purpose client reception sources client, the message bag of receiving by parsing obtains source IP address;
Perhaps, the connection request of purpose client reception sources client, the message bag of receiving by parsing obtains source IP address; The purpose client is from the IP address of the HSvr reception sources IUsr correspondence of purpose IUsr ownership;
B, judge whether the corresponding IP address of described source IP address and the source IUsr of reception is consistent, if consistent, then, consistency checking passes through, otherwise, do not pass through.
6. a cross-domain CC connects method for building up, it is characterized in that, said method comprising the steps of:
A, source client will comprise that the message request of purpose IUsr information sends to the HSvr of source IUsr ownership, i.e. source HSvr;
The IP address that b, described source HSvr obtain source IUsr will comprise that the invitation message of the good purpose IUsr of GUID of IP address, the source IUsr of described source IUsr sends to the HSvr of described purpose IUsr ownership, i.e. purpose HSvr;
C, described purpose HSvr obtain the IP address of described purpose IUsr; The IP address of described purpose IUsr is replied to source HSvr, should reply message by source HSvr and send to described source client, described source client receives described answer message; Described invitation message is sent to purpose IUsr clients corresponding;
D, described purpose client are initiated connection request according to the IP address of the source IUsr that receives to the source client, described source client is obtained the peer IP address of connection request, judge whether this IP address is the IP address of purpose client described in the described answer message, if, then accept connection request, and set up the CC connection; Perhaps described source client is initiated connection request according to the IP address of the purpose IUsr that receives to the purpose client, described purpose client is obtained the peer IP address of connection request, judge whether this IP address is the IP address of source client described in the described invitation message, if, then accept connection request, and set up the CC connection.
7. a GUID addressing method is characterized in that, said method comprising the steps of:
A, set up the corresponding relation of HCode and HSvr;
B, according to the HCode of the GUID correspondence corresponding relation according to described HCode and HSvr, determine the HSvr of this GUID ownership.
8. method according to claim 7 is characterized in that, step a refers to:
The corresponding relation of described HCode and HSvr is kept at this locality, and corresponding, step b refers to: determine the HSvr that this GUID belongs to the described HCode that preserves from this locality according to the HCode of GUID correspondence and the corresponding relation of HSvr;
Perhaps, foundation communicates to connect with GUIDAS's, and described GUIDAS has preserved the corresponding relation of HCode and HSvr, and corresponding, step b refers to: according to the HCode of GUID correspondence, visit GUIDAS obtains the HSvr of this GUID ownership;
Perhaps, the corresponding relation of the described HCode of foundation and HSvr is that the domain name constructing module is set, and is corresponding, step b refers to: according to the HCode of GUID correspondence, by the domain name constructing module that arranges, produce HDomain, by resolving the HSvr that the HDomain that produces determines that this GUID belongs to.
9. one kind is obtained the method for HSvr host IP address according to HCode, it is characterized in that, sets in advance the domain name constructing module, said method comprising the steps of:
A, according to this HCode, by the domain name constructing module that arranges, obtain the HDomain of this HCode correspondence;
B, by the HDomain that obtains is resolved, obtain corresponding host IP address.
10. a HSvr is characterized in that, comprises central processing module, communication access module, memory module;
Described communication access module is used for the access communications network, carries out information interaction with client; Described communication access module also is used for setting up being connected with the SS of other HSvr, connects with described other HSvr by the SS that sets up and carries out information interaction;
Described storage module is used for preserving the corresponding relation that HCode is connected with SS;
For the message that comprises purpose GUID that receives, central processing module according to the HCode that sets up and the corresponding relation of HSvr, carries out addressing according to the HCode of purpose GUID in the message, determines that corresponding SS connects; To comprise that by the SS connection of determining the message of purpose GUID sends to opposite end HSvr.
CN201310037232XA 2012-02-23 2013-01-31 Communication method and system Pending CN103297321A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310037232XA CN103297321A (en) 2012-02-23 2013-01-31 Communication method and system

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201210041577 2012-02-23
CN201210041577.8 2012-02-23
CN201310037232XA CN103297321A (en) 2012-02-23 2013-01-31 Communication method and system

Publications (1)

Publication Number Publication Date
CN103297321A true CN103297321A (en) 2013-09-11

Family

ID=49097663

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310037232XA Pending CN103297321A (en) 2012-02-23 2013-01-31 Communication method and system

Country Status (1)

Country Link
CN (1) CN103297321A (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020165961A1 (en) * 2001-04-19 2002-11-07 Everdell Peter B. Network device including dedicated resources control plane
US20030014479A1 (en) * 2001-07-12 2003-01-16 Shafron Thomas Joshua Method and system for enabling a script on a first computer to communicate and exchange data with a script on a second computer over a network
CN1518703A (en) * 2001-03-26 2004-08-04 ��Ѷ�Ƽ������ڣ����޹�˾ Instant messaging system and method
WO2007021111A1 (en) * 2005-08-12 2007-02-22 Samsung Electronics Co., Ltd. Group management method and system in interworking system of imps system and simple im system
CN101197738A (en) * 2006-12-06 2008-06-11 赵建奇 Wide band mobile visible communication network system
CN101631140A (en) * 2009-08-03 2010-01-20 中兴通讯股份有限公司 Cluster server of instant communication system and method of inter-clusters communication
US20100069095A1 (en) * 2008-09-15 2010-03-18 Microsoft Corporation System and methods for communication between instant message users and short message service users
CN101883057A (en) * 2009-05-04 2010-11-10 上海赢思软件技术有限公司 A method and device for realizing instant messaging among multiple members in an instant messaging group
CN102202015A (en) * 2011-06-09 2011-09-28 张李影 Method and system for realizing intercommunication among different kinds of instant messaging tools
CN102223293A (en) * 2010-04-16 2011-10-19 中兴通讯股份有限公司 Routing method of information requests and processing system
CN102333105A (en) * 2010-07-14 2012-01-25 华为技术有限公司 Method, system, push client and user equipment for business communication

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1518703A (en) * 2001-03-26 2004-08-04 ��Ѷ�Ƽ������ڣ����޹�˾ Instant messaging system and method
US20020165961A1 (en) * 2001-04-19 2002-11-07 Everdell Peter B. Network device including dedicated resources control plane
US20030014479A1 (en) * 2001-07-12 2003-01-16 Shafron Thomas Joshua Method and system for enabling a script on a first computer to communicate and exchange data with a script on a second computer over a network
WO2007021111A1 (en) * 2005-08-12 2007-02-22 Samsung Electronics Co., Ltd. Group management method and system in interworking system of imps system and simple im system
CN101197738A (en) * 2006-12-06 2008-06-11 赵建奇 Wide band mobile visible communication network system
US20100069095A1 (en) * 2008-09-15 2010-03-18 Microsoft Corporation System and methods for communication between instant message users and short message service users
CN101883057A (en) * 2009-05-04 2010-11-10 上海赢思软件技术有限公司 A method and device for realizing instant messaging among multiple members in an instant messaging group
CN101631140A (en) * 2009-08-03 2010-01-20 中兴通讯股份有限公司 Cluster server of instant communication system and method of inter-clusters communication
CN102223293A (en) * 2010-04-16 2011-10-19 中兴通讯股份有限公司 Routing method of information requests and processing system
CN102333105A (en) * 2010-07-14 2012-01-25 华为技术有限公司 Method, system, push client and user equipment for business communication
CN102202015A (en) * 2011-06-09 2011-09-28 张李影 Method and system for realizing intercommunication among different kinds of instant messaging tools

Similar Documents

Publication Publication Date Title
CN100583839C (en) Method and system for implementing multi-identity immediate message communication and present service of single account number
CN101420657B (en) Method for message transmission between heterogeneous networks and apparatus thereof
US7631039B2 (en) Initiation and support of video conferencing using instant messaging
US20030018726A1 (en) Instant messaging
Crocker Internet mail architecture
US5424724A (en) Method and apparatus for enhanced electronic mail distribution
EP1599979B1 (en) Message management
CN101374118B (en) A kind of method, system and device of information interconnect
US20050044144A1 (en) Instant messaging architecture and system for interoperability and presence management
US20070100944A1 (en) Uniform resource identifier decoration to enable connectivity for instant messaging providers serving non-authoritative namespaces
US20030028597A1 (en) Separation of instant messaging user and client identities
US20040128352A1 (en) Method and system for facilitating instant messaging transactions between disparate service providers
US20100331021A1 (en) Method and system for interworking between instant messaging service and short message service
CN101309233A (en) Method realizing TCP connection reusing in instant communication
CN102223293B (en) The method for routing of message request and treatment system
CN102035655A (en) Implementation method for end-to-end instant messaging, and end-to-end instant messaging terminal and system
CN102282872B (en) Method for delivering message based on cpm service and server thereof
US20050267984A1 (en) Method and apparatus for interoperability and relay for WV and IMS group management services
CN104184647A (en) Social e-mail communication system and method
CN1322725C (en) Method for receiving and transmitting e-mail using digital number and its mail system
CN103297321A (en) Communication method and system
EP1004188B1 (en) Electronic mail
CN102957593A (en) Method and device for interaction of in-station messages with out-station messages
CN103546360B (en) A kind of information acquisition method, system and IMAP clients
CN103297555A (en) Shadow code addressing method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: Wuhou District Shaoling road Chengdu city Sichuan province 610000 No. 29 2-2-3 Li Huaijiang

Applicant after: Wang Zhengwei

Address before: 610000 Sichuan city in Chengdu province Wuhou Temple Street No. 87 (empty Jiashuyuan) 1 Building 1 unit 3

Applicant before: Wang Zhengwei

WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20130911

WD01 Invention patent application deemed withdrawn after publication