JP2015119217A - Communication system and terminal device - Google Patents

Communication system and terminal device Download PDF

Info

Publication number
JP2015119217A
JP2015119217A JP2013259476A JP2013259476A JP2015119217A JP 2015119217 A JP2015119217 A JP 2015119217A JP 2013259476 A JP2013259476 A JP 2013259476A JP 2013259476 A JP2013259476 A JP 2013259476A JP 2015119217 A JP2015119217 A JP 2015119217A
Authority
JP
Japan
Prior art keywords
port number
terminal
server
source
transmission
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
JP2013259476A
Other languages
Japanese (ja)
Inventor
貴洋 原
Takahiro Hara
貴洋 原
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.)
Yamaha Corp
Original Assignee
Yamaha Corp
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 Yamaha Corp filed Critical Yamaha Corp
Priority to JP2013259476A priority Critical patent/JP2015119217A/en
Priority to PCT/JP2014/079027 priority patent/WO2015093158A1/en
Priority to US15/104,754 priority patent/US9923866B2/en
Priority to EP14872201.0A priority patent/EP3086517A4/en
Publication of JP2015119217A publication Critical patent/JP2015119217A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To enable direct communication between two terminals even in a case where a NAT router that performs different transmission source port number conversion when only a destination port number is changed is interposed.SOLUTION: In a communication system, terminals (PC1 and PC2) subordinate to an NAT router communicate with each other by using a transmission source address, a transmission source port number, a destination address, and a destination port number. The PC1, PC2 transmits data to a server to notify the partner side PC2, PC1 of the transmission source port number. The server notifies the PC2, PC1 of a port number based on the transmission source port number used for the data transmission by the PC1, PC2. The PC1, PC2 uses a transmission source port number different from the transmission source port number used for the data transmission to the server, and transmits data by using a port number based on the received port number related to the PC2, PC1 as a destination port number to try to connect with the PC2, PC1.

Description

この発明は、インターネットのような広域通信ネットワークに接続された別々のNATルータの配下にある端末装置の間で直接通信を行う通信システム及び端末装置に関する。   The present invention relates to a communication system and a terminal device that perform direct communication between terminal devices under the control of separate NAT routers connected to a wide area communication network such as the Internet.

従来より、インターネットなどの広域通信ネットワークを介した楽器の演奏(合奏)やデュエット等の合唱などの音楽的なセッションを可能としたネットワークセッションシステムは知られている。このセッションシステムは、自端末での演奏に基づく演奏情報を広域通信ネットワークを介して他端末に送信し合って各端末で両端末の演奏楽音を発音させようというものであるが、各端末が夫々のNAT(Network Address Translation)ルータの配下(ローカル側)にある場合に、複数の端末間で、サーバを介することなく、直接、演奏情報を交信するには、NATルータを超えなければならないという問題がある。   2. Description of the Related Art Conventionally, network session systems that enable musical sessions such as musical instrument performance (ensemble) and duet chorus via a wide-area communication network such as the Internet are known. In this session system, performance information based on the performance of its own terminal is transmitted to other terminals via a wide-area communication network so that each terminal can play musical sounds of both terminals. When the performance information is communicated directly between a plurality of terminals without going through a server when it is under the network address translation (NAT) router (local side), the NAT router must be exceeded. There is.

NAT技術については、下記非特許文献1の「RFC4787」に記載されている。RFC4787は、IETF( Internet Engineering Task Force)が公表する技術仕様であり、ユニキャストUDPでのNAT越えに関連するNAT特性について解説されている。NATルータの振舞いとしては、エンドポイント非依存マッピング、アドレス依存マッピング及びアドレス&ポート番号依存マッピングという3つのパターンが、一般的によく知られている。そこで、これら3つのNATルータの振舞いのパターンについて触れる。図1A乃至図1Cは、NATルータの振舞いパターンを説明するための図であり、上述した3つのNATルータの内部では、このNATルータの配下にあるPC(パーソナルコンピュータ)などの送信元端末から、同じ「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」の組を使って送信した場合、図1A乃至図1Cのように、送信元アドレスと送信元ポート番号が変換される。   The NAT technology is described in “RFC 4787” of Non-Patent Document 1 below. RFC4787 is a technical specification published by IETF (Internet Engineering Task Force), and describes NAT characteristics related to NAT traversal in unicast UDP. As NAT router behavior, three patterns of endpoint-independent mapping, address-dependent mapping, and address & port number-dependent mapping are generally well known. Therefore, the behavior patterns of these three NAT routers will be mentioned. FIG. 1A to FIG. 1C are diagrams for explaining the behavior pattern of a NAT router. Inside the above three NAT routers, from a transmission source terminal such as a PC (personal computer) under the NAT router, When transmission is performed using the same combination of “source address: 192.168.0.1” and “source port number: 5000”, the source address and the source port number are as shown in FIGS. 1A to 1C. Converted.

http://www.ietf.org/rfc/rfc4787.txthttp://www.ietf.org/rfc/rfc4787.txt

図1Aのパターン1は、NATルータの配下から同じ送信元アドレス及び送信元ポート番号を使ってパケットを送信する場合には、どの宛先アドレス及び宛先ポート番号に送信しても、同じポート番号変換を行うタイプのNATルータの振舞いを示しており、RFC4787では「エンドポイント非依存マッピング」と定義されている。このパターン1では、図示左側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5000」にパケット1を送信することにより、PC1からサーバにパケット1を送信した例を示している。図示中央の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5001」にパケット2を送信することにより、PC1からサーバにパケット2を送信した例を示している。図示右側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:3.3.3.3」及び「宛先ポート番号:5000」にパケット3を送信することにより、PC1からPC2にパケット3を送信した例を示している。これらの場合、PC1を配下とするNATルータは、宛先アドレス及び宛先ポート番号が異なっていても、同じ送信元アドレス及び送信元ポート番号を使っているために、同じ送信元ポート番号の変換を行い、全てのパケット1〜3の送信において、例えば「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は、「送信元アドレス:1.1.1.1及び送信元ポート番号:20000」にそれぞれ変換される。なお、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」はローカルアドレスであり、「送信元アドレス:1.1.1.1」及び「送信元ポート番号:20000」、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5000」、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5001」、並びに「宛先アドレス:3.3.3.3」及び「宛先ポート番号:5000」はグローバルアドレスである。ローカルアドレス及びグローバルアドレスに関しては、後述する場合も同様である。   In pattern 1 of FIG. 1A, when a packet is transmitted from the subordinate of the NAT router using the same source address and source port number, the same port number conversion is performed regardless of the destination address and destination port number. The behavior of the type of NAT router is shown, and is defined as “endpoint-independent mapping” in RFC4787. In this pattern 1, in the case of the left side of the figure, “destination address: 2.2.2.2” using “source address: 192.168.0.1” and “source port number: 5000”. In the example, packet 1 is transmitted from PC 1 to the server by transmitting packet 1 to “destination port number: 5000”. In the case of the center in the figure, “source address: 192.168.0.1” and “source port number: 5000” are used, and “destination address: 2.2.2.2” and “destination port number” are used. : 2 is transmitted to the server by transmitting packet 2 to “5001”. In the case of the right side of the figure, “destination address: 3.3.3.3” and “destination port number” are used by using “source address: 192.168.0.1” and “source port number: 5000”. : Packet 5000 is transmitted to PC2 by transmitting packet 3 to “5000”. In these cases, the NAT router under the control of PC1 converts the same source port number because the same source address and source port number are used even if the destination address and destination port number are different. In the transmission of all packets 1 to 3, for example, “transmission source address: 192.168.0.1” and “transmission source port number: 5000” are “transmission source address: 1.1.1.1 and transmission”. Original port number: 20000 ". Note that “source address: 192.168.0.1” and “source port number: 5000” are local addresses, and “source address: 1.1.1.1” and “source port number: “20000”, “destination address: 2.2.2.2” and “destination port number: 5000”, “destination address: 2.2.2.2” and “destination port number: 5001”, and “destination address: “3.3.3.3” and “destination port number: 5000” are global addresses. The same applies to the local address and the global address as will be described later.

図1Bのパターン2は、NATルータの配下から同じ送信元アドレス及び送信元ポート番号を使ってパケットを送信する場合、宛先アドレスが変わると、異なるポート番号変換を行うタイプのNATルータの振舞いを示しており、RFC4787では「アドレス依存マッピング」と定義されている。この場合、送信元ポート番号は、シーケンシャルに変換される(すなわち、一つ前の変換結果に「+1」が加算される)。このパターン2では、図示左側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号5000」にパケット1を送信することにより、PC1からサーバにパケット1を送信した例を示している。図示中央の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5001」にパケット2を送信することにより、PC1からサーバにパケット2を送信した例を示している。図示右側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:3.3.3.3」及び「宛先ポート番号:5000」にパケット3を送信することにより、PC1からPC2にパケット3を送信した例を示している。これらの場合、PC1を配下とするNATルータは、宛先アドレスが異なると、同じ送信元アドレス及び送信元ポート番号を使っていても、異なる送信元ポート番号の変換を行い、例えば、パケット1,2の送信においては「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は「送信元アドレス:1.1.1.1及び送信元ポート番号:20000」にそれぞれ変換され、パケット3の送信においては「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は「送信元アドレス:1.1.1.1及び送信元ポート番号:20001」に変換される。   Pattern 2 in FIG. 1B shows the behavior of a NAT router of a type that performs different port number conversion when the destination address changes when a packet is transmitted from the subordinate of the NAT router using the same source address and source port number. RFC4787 defines “address-dependent mapping”. In this case, the source port number is converted sequentially (that is, “+1” is added to the previous conversion result). In this pattern 2, in the case of the left side of the figure, “destination address: 2.2.2.2” using “source address: 192.168.0.1” and “source port number: 5000”. In the example, packet 1 is transmitted from the PC 1 to the server by transmitting the packet 1 to the “destination port number 5000”. In the case of the center in the figure, “source address: 192.168.0.1” and “source port number: 5000” are used, and “destination address: 2.2.2.2” and “destination port number” are used. : 2 is transmitted to the server by transmitting packet 2 to “5001”. In the case of the right side of the figure, “destination address: 3.3.3.3” and “destination port number” are used by using “source address: 192.168.0.1” and “source port number: 5000”. : Packet 5000 is transmitted to PC2 by transmitting packet 3 to “5000”. In these cases, if the NAT router under the control of PC1 has different destination addresses, it converts different source port numbers even if the same source address and source port number are used. "Transmission source address: 192.168.0.1" and "Transmission source port number: 5000" are converted into "Transmission source address: 1.1.1.1 and Transmission port number: 20000" respectively. In transmission of packet 3, “source address: 192.168.0.1” and “source port number: 5000” are “source address: 1.1.1.1 and source port number: 20001”. Is converted to.

図1Cのパターン3は、NATの配下から同じ送信元アドレスと送信元ポート番号を使って送信する場合、宛先アドレス及び宛先ポート番号の一方のみが変わるだけで、異なるポート番号変換を行うタイプのNATルータの振舞いを示しており、RFC4787では「アドレス&ポート番号依存マッピング」と定義されている。この場合も、送信元ポート番号は、シーケンシャルに変換される(すなわち、一つ前の変換結果に「+1」が加算される)。このパターン3では、図示左側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号5000」にパケット1を送信することにより、PC1からサーバにパケット1を送信した例を示している。図示中央の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5001」にパケット2を送信することにより、PC1からサーバにパケット2を送信した例を示している。図示右側の場合には、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:3.3.3.3」及び「宛先ポート番号:5000」にパケット3を送信することにより、PC1からPC2にパケット3を送信した例を示している。これらの場合、PC1を配下とするNATルータは、宛先アドレス及び宛先ポート番号の一方が異なると、同じ送信元アドレス及び送信元ポート番号を使っていても、異なる送信元ポート番号の変換を行い、例えば、パケット1の送信においては「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は「送信元アドレス:1.1.1.1及び送信元ポート番号:20000」に変換され、パケット2の送信においては「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は「送信元アドレス:1.1.1.1及び送信元ポート番号:20001」に変換され、パケット3の送信においては「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」は「送信元アドレス:1.1.1.1及び送信元ポート番号:20002」に変換される。   Pattern 3 in FIG. 1C is a type of NAT that performs different port number conversion only when either the destination address or the destination port number changes when transmitting using the same source address and source port number from under the NAT. This shows the behavior of the router, and is defined as “address & port number dependent mapping” in RFC4787. Also in this case, the source port number is converted sequentially (that is, “+1” is added to the previous conversion result). In this pattern 3, in the case of the left side of the figure, “destination address: 2.2.2.2” using “source address: 192.168.0.1” and “source port number: 5000”. In the example, packet 1 is transmitted from the PC 1 to the server by transmitting the packet 1 to the “destination port number 5000”. In the case of the center in the figure, “source address: 192.168.0.1” and “source port number: 5000” are used, and “destination address: 2.2.2.2” and “destination port number” are used. : 2 is transmitted to the server by transmitting packet 2 to “5001”. In the case of the right side of the figure, “destination address: 3.3.3.3” and “destination port number” are used by using “source address: 192.168.0.1” and “source port number: 5000”. : Packet 5000 is transmitted to PC2 by transmitting packet 3 to “5000”. In these cases, if one of the destination address and the destination port number is different, the NAT router under the control of PC1 performs conversion of a different source port number even if the same source address and source port number are used. For example, in transmission of the packet 1, “source address: 192.168.0.1” and “source port number: 5000” are “source address: 1.1.1.1 and source port number: 20000”. In the transmission of the packet 2, “source address: 192.168.0.1” and “source port number: 5000” are “source address: 1.1.1.1 and source port” Number: 20001 ", and in transmission of packet 3," source address: 192.168.0.1 "and" source port number: 5000 " Source address: 1.1.1.1 and the source port number: 20002 is converted to ".

ところで、このようにNATルータの配下にある2つの端末同士で直接の通信を行おうとすると、上述した夫々のNATルータによる送信元アドレス及び送信元ポート番号の変換の影響を受けて、変換後のアドレス及びポート番号を何らかの方法で知らなければ両端末の接続を行うことができない。   By the way, when direct communication is performed between two terminals under the NAT router in this way, the conversion is performed under the influence of the source address and source port number conversion by each NAT router described above. Both terminals cannot be connected without knowing the address and port number in some way.

例えば、NATルータ1の配下にある端末PC1及びNATルータ2の配下にある端末PC2が、お互いの外部(グローバル)の「IPアドレス:3.3.3.3;1.1.1.1」を知っており、「ポート番号:5000」での通信を行おうとして、図2のように、同じ「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使うとともに、PC1からは「宛先アドレス:3.3.3.3」及び「宛先ポート番号:5000」にパケットを送信し、PC2からは「宛先アドレス:1.1.1.1」及び「宛先ポート番号:5000」にパケットを送信して通信しようとしても、NATルータ1,2で変換された「送信元ポート番号:20000,30000」は、それぞれ、NATルータ2,1の「宛先ポート番号:5000」と一致しないので、NATルータ2,1を通過することができない。   For example, the terminal PC1 under the NAT router 1 and the terminal PC2 under the NAT router 2 are connected to each other's external (global) “IP address: 3.3.3.3; 1.1.1.1”. As shown in FIG. 2, the same “source address: 192.168.0.1” and “source port number: 5000” are used to perform communication at “port number: 5000”. In addition, the PC 1 transmits a packet to “destination address: 3.3.3.3” and “destination port number: 5000”, and the PC 2 transmits “destination address: 1.1.1.1” and “destination port”. Even if a packet is transmitted to the number “5000” and the communication is attempted, the “source port number: 20000, 30000” converted by the NAT routers 1 and 2 is respectively the “destination port” of the NAT router 2 and 1. Number: because it does not coincide with the 5000 ", can not pass through the NAT router 2,1.

このような場合、一般的に「UDPホールパンチング」として知られる手法を使うことで、パターン1及びパターン2での通信を行うことができるようになる。例えば、NATルータの配下にないサーバを用意し、各PC1,2は、NATルータ1,2を通じてこのサーバへ通信を行うと、サーバは、それぞれのNATルータ1,2で変換された後のアドレス及びポート番号を知ることができるので、PC1には「PC2のアドレスと変換後のポート番号は3.3.3.3の30000番です」と、PC2には「PC1のアドレスと変換後のポート番号は、1.1.1.1の20000番です」というように、お互いに通知する。NATルータ1,2がパターン1のルータであれば、PC1,2は、サーバから通知された相手PC2,1側のアドレス及びポート番号を宛先にして送信すると、NATルータを通過することができる。なお、図2中のPC1のアドレスとPC2のアドレスは共に「192.168.0.1」であるが、これらのアドレスはローカルアドレスであるので同じであってもよいし、異なっていてもよい。この点に関しては、他の図面においても同様である。   In such a case, by using a technique generally known as “UDP hole punching”, it is possible to perform communication using the pattern 1 and the pattern 2. For example, when a server that is not under the control of a NAT router is prepared and each of the PCs 1 and 2 communicates with the server through the NAT routers 1 and 2, the server addresses after being converted by the NAT routers 1 and 2. Since PC1 can know the port number, the PC1 address and the converted port number are 33.3, 3.33.3, and the PC2 address is the PC1 address and the converted port number. The number is 20000 of 1.1.1.1 ”. If the NAT routers 1 and 2 are the routers of the pattern 1, the PCs 1 and 2 can pass through the NAT router by transmitting the addresses and port numbers of the counterpart PCs 2 and 1 notified from the server. Note that the addresses of PC1 and PC2 in FIG. 2 are both “192.168.0.1”, but these addresses may be the same or different because they are local addresses. . This also applies to the other drawings.

また、NATルータ1,2がパターン2のルータである場合には、サーバから通知されたポート番号を使っても通過できないが、NATによる変換後の送信元ポート番号は、多くの場合、「30000」→「30001」のようなシーケンシャルな変化なので、ポート番号スキャンのように前後のポート番号を連続的に試すことで通過することができる。前述の例では、PC1は、「30000」が駄目であると「30001」を試し、PC2は、「20000」が駄目であると「20001」を試すことで通過することができる。つまり、パターン2のルータでは、同じ宛先アドレスに対してであれば、次のように、宛先ボート番号を変化させても送信元ポート番号は変わらないので、前後のポート番号を試すことにより、そのうち通過する組み合わせが現れることが期待できる。
(PC1側)NAT変換後の送信元ポート番号 あて先ポート番号
20001 → 30000
20001 → 30001 ◎
20001 → 30002
… …
(PC2側)NAT変換後の送信元ポート番号 あて先ポート番号
30001 → 20000
30001 → 20001 ◎
30001 → 20002
… …
If the NAT routers 1 and 2 are pattern 2 routers, they cannot pass even if the port number notified from the server is used, but the source port number after conversion by NAT is often “30000”. Since it is a sequential change such as “→“ 30001 ”, it can be passed by successively testing the port numbers before and after the port number scan. In the above example, PC1 can pass “30000” if “30000” is useless, and PC2 can pass by trying “20001” if “20000” is useless. In other words, in the router of pattern 2, if it is for the same destination address, the source port number does not change even if the destination port number is changed as follows. You can expect to see combinations that pass through.
(PC1 side) Source port number after NAT conversion Destination port number
20001 → 30000
20001 → 30001 ◎
20001 → 30002
……
(PC2 side) Source port number after NAT conversion Destination port number
30001 → 20000
30001 → 20001 ◎
30001 → 20002
……

このように、UDPホールパンチング手法を使うことによって、図1Aのようなパターン1及び図1Bのようなパターン2のタイプのNATルータでの通信を行うことができるようになる。しかしながら、図1Cのように、NATルータ1,2が共にパターン3のルータの場合、即ち、同じ送信元アドレス及び送信元ポート番号から同じ宛先アドレスに送信されていても、宛先ポート番号が変わるだけで異なるポート変換をするタイプのNATルータである場合には、それらのNATルータへの対応はできない。つまり、前記パターン2のように前後のポート番号を連続的に試しても、今度は試すたびにNATルータによるポート変換後の送信元ポート番号が変化してしまうため、次のように、いつまでたっても追いつけず、通過することができない。なお、NATルータ1,2の一方がパターン1又はパターン2であれば、パターン1又はパターン2のNATルータによる返還後の送信元ポート番号は変化しないので、前記UDホールパンチング手法を使うことにより、通信を行うことができる。
(PC1側)NAT変換後の送信元ポート番号 あて先ポート番号
20001 → 30000
20002 → 30001
20003 → 30002
20004 → 30003
… …
(PC2側)NAT変換後の送信元ポート番号 あて先ポート番号
30001 → 20000
30002 → 20001
30003 → 20002
30004 → 20003
… …
As described above, by using the UDP hole punching method, it is possible to perform communication using the NAT router of the pattern 1 as shown in FIG. 1A and the pattern 2 as shown in FIG. 1B. However, as shown in FIG. 1C, when both the NAT routers 1 and 2 are routers of pattern 3, that is, even if the same source address and source port number are transmitted to the same destination address, the destination port number only changes. In the case of NAT routers that perform different port conversions, the NAT routers cannot be supported. In other words, even if the previous and next port numbers are tried consecutively as in Pattern 2, the source port number after port conversion by the NAT router changes each time this is tried, so that I cannot catch up and cannot pass. If one of the NAT routers 1 and 2 is pattern 1 or pattern 2, the source port number after the return by the NAT router of pattern 1 or pattern 2 does not change, so by using the UD hole punching method, Communication can be performed.
(PC1 side) Source port number after NAT conversion Destination port number
20001 → 30000
20002 → 30001
20003 → 30002
20004 → 30003
……
(PC2 side) Source port number after NAT conversion Destination port number
30001 → 20000
30002 → 20001
30003 → 20002
30004 → 20003
……

この発明は、このような事情に鑑み、別々のNATルータ配下にある2つの端末の間で、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って通信を行う際に、宛先ポート番号が変わっただけで異なる送信元ポート番号の変換を行うNATルータが介在しても、両端末間で直接通信を行うことができる通信システム、端末装置などを提供することを目的とする。なお、下記本発明の各構成要件の記載においては、本発明の理解を容易にするために、実施形態の対応箇所の符号を括弧内に記載しているが、本発明の構成要件は、実施形態の符号によって示された対応箇所の構成に限定解釈されるべきものではない。   In view of such circumstances, the present invention provides a destination address when performing communication between two terminals under different NAT routers using a source address, a source port number, a destination address, and a destination port number. It is an object of the present invention to provide a communication system, a terminal device, and the like that can perform direct communication between both terminals even if a NAT router that performs conversion of different source port numbers only by changing the port number is interposed. In the description of each constituent element of the present invention below, the reference numerals of corresponding portions of the embodiment are shown in parentheses in order to facilitate understanding of the present invention. The present invention should not be construed as being limited to the configurations of the corresponding portions indicated by the reference numerals of the forms.

本発明の特徴は、第1NATルータ(NRa)の配下にある第1端末(TMa)と、第2NATルータ(NRb)の配下にある第2端末(TMb)と、NATルータの配下にないサーバ(SV)とから成り、第1端末及び第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、第1NATルータ及び第2NATルータを介して互いに通信する通信システムにおいて、サーバは、第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を第2端末に通知するとともに、第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を前記第1端末に通知し(S5)、第1端末は、第2端末に送信元ポート番号を通知するためにサーバにデータを送信する第1送信手段(C3)と、サーバから通知された第2端末に関するポート番号を受信する第1ポート番号受信手段(C4)と、第1送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、第1ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより第2端末への接続を試行する第1試行手段(C5,C6)とを備え、かつ第2端末は、第1端末に送信元ポート番号を通知するためにサーバにデータを送信する第2送信手段(C3)と、サーバから通知された第1端末に関するポート番号を受信する第2ポート番号受信手段(C4)と、第2送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、第2ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより第2端末への接続を試行する第2試行手段(C5,C6)とを備えたことにある。   The feature of the present invention is that a first terminal (TMa) under the first NAT router (NRa), a second terminal (TMb) under the second NAT router (NRb), and a server (not under the NAT router) In the communication system in which the first terminal and the second terminal communicate with each other via the first NAT router and the second NAT router using the source address, the source port number, the destination address and the destination port number. The server notifies the second terminal of the port number based on the transmission source port number used for data transmission to notify the transmission source port number by the first terminal, and sets the transmission source port number by the second terminal. The first terminal is notified of the port number based on the transmission source port number used for data transmission for notification (S5), and the first terminal notifies the second terminal. A first transmission means (C3) for transmitting data to the server to notify the source port number; a first port number receiving means (C4) for receiving a port number related to the second terminal notified from the server; Use a source port number different from the source port number used for data transmission by one transmission means, and transmit the data using the port number based on the port number received by the first port number reception means as the destination port number. And a first trial means (C5, C6) for trying to connect to the second terminal, and the second terminal transmits data to the server in order to notify the first terminal of the source port number. Used for data transmission by the transmission means (C3), the second port number reception means (C4) for receiving the port number related to the first terminal notified from the server, and the second transmission means Using a source port number different from the source port number and transmitting data using the port number based on the port number received by the second port number receiving means as the destination port number, and trying to connect to the second terminal. The second trial means (C5, C6) is provided.

この場合、例えば、サーバは、さらに、第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元アドレスを第2端末に通知するとともに、第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元アドレスを第1端末に通知し、第1端末の第1ポート番号受信手段は、さらに、サーバから通知された第2端末の送信元アドレスを受信し、第1端末の第1試行手段は、さらに、第1ポート番号受信手段により受信した送信元アドレスも使って第2端末への接続を試行し、第2端末の第2ポート番号受信手段は、さらに、サーバから通知された第1端末の送信元アドレスを受信し、第2端末の第2試行手段は、さらに、第2ポート番号受信手段により受信した送信元アドレスも使って第1端末への接続を試行する。   In this case, for example, the server further notifies the second terminal of the source address used for data transmission to notify the source port number by the first terminal, and the source port number by the second terminal. The first port number reception means of the first terminal further notifies the transmission source address of the second terminal notified from the server. The first trial means of the first terminal further attempts to connect to the second terminal using the source address received by the first port number reception means, and the second port number reception means of the second terminal Further receives the source address of the first terminal notified from the server, and the second trial means of the second terminal further uses the source address received by the second port number receiving means to use the first terminal. Attempting to connect to.

また、例えば、サーバは、第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に「+1」を加算したポート番号を第2端末に通知するとともに、第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に「+1」を加算したポート番号を第1端末に通知し、第1端末の第1試行手段は、第1ポート番号受信手段により受信したポート番号を宛先ポート番号としてデータを送信することにより第2端末への接続を試行し、かつ第2端末の第2試行手段は、第2ポート番号受信手段により受信したポート番号を宛先ポート番号としてデータを送信することにより第1端末への接続を試行する。また、サーバは、第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号を第2端末に通知するとともに、第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号を第1端末に通知し、第1端末の第1試行手段は、第1ポート番号受信手段により受信した送信元ポート番号に「+1」を加算したポート番号を宛先ポート番号としてデータを送信することにより第2端末への接続を試行し、かつ第2端末の第2試行手段は、第2ポート番号受信手段により受信した送信元ポート番号に「+1」を加算したポート番号を宛先ポート番号としてデータを送信することにより第1端末への接続を試行してもよい。   Further, for example, the server notifies the second terminal of the port number obtained by adding “+1” to the transmission source port number used for data transmission in order to notify the transmission source port number by the first terminal, and Two terminals notify the first terminal of the port number obtained by adding “+1” to the transmission source port number used for data transmission to notify the transmission source port number, and the first trial means of the first terminal includes: The connection to the second terminal is attempted by transmitting data using the port number received by the first port number receiving means as the destination port number, and the second trial means of the second terminal is controlled by the second port number receiving means. A connection to the first terminal is attempted by transmitting data using the received port number as the destination port number. In addition, the server notifies the second terminal of the transmission source port number used for data transmission to notify the transmission source port number by the first terminal, and also notifies the transmission source port number by the second terminal. The source port number used for data transmission is notified to the first terminal, and the first trial means of the first terminal adds “+1” to the source port number received by the first port number receiving means. The second trial unit of the second terminal tries to connect to the second terminal by transmitting data with the port number as the destination port number, and the second trial unit of the second terminal adds “+1” to the transmission source port number received by the second port number receiving unit. The connection to the first terminal may be attempted by transmitting data using the port number to which "is added" as the destination port number.

また、本発明を他の観点からみれば、本発明の特徴は、第1NATルータ(NRa)の配下にある第1端末(TMa)と、第2NATルータ(NRb)の配下にある第2端末(TMb)と、NATルータの配下にないサーバ(SV)とから成り、第1端末及び第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、第1NATルータ及び第2NATルータを介して互いに通信する通信システムにおける第1端末を構成する端末装置であって、第2端末に送信元ポート番号を通知するためにサーバにデータを送信する送信手段(C3)と、サーバから通知された第2端末に関するポート番号を受信するポート番号受信手段(C4)と、送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより第2端末への接続を試行する試行手段(C5,C6)とを備えた端末装置にもある。   From another point of view, the present invention is characterized in that the first terminal (TMa) under the first NAT router (NRa) and the second terminal under the second NAT router (NRb) ( TMb) and a server (SV) not under the NAT router, the first terminal and the second terminal use the source address, source port number, destination address and destination port number to A terminal device constituting a first terminal in a communication system communicating with each other via a second NAT router, and transmitting means (C3) for transmitting data to a server in order to notify a source port number to the second terminal; The port number receiving means (C4) for receiving the port number related to the second terminal notified from the server is different from the source port number used for data transmission by the transmitting means. Trial means (C5, C6) that uses the source port number and tries to connect to the second terminal by transmitting data using the port number based on the port number received by the port number receiving means as the destination port number. There is also a terminal device.

前記のように構成した、本発明においては、第1及び第2端末間の直接通信に先立って、まず、第1及び第2端末の第1及び第2送信手段は、それぞれ相手方に送信元ポート番号を通知するためにサーバにデータを送信する。サーバは、第1及び第2送信手段によってデータの送信に使われた送信元ポート番号に基づくポート番号を第2及び第1端末にそれぞれ通知する。第1及び第2端末においては、第1及び第2ポート番号受信手段が、前記サーバから通知されたポート番号をそれぞれ受信し、第1及び第2試行手段は、第1及び第2送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使って、前記受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより第2及び第1端末への接続をそれぞれ試行する。この場合、送信元ポート番号が変更されると、両NATルータは送信元ポート番号を一定のルールで変更するという性質を有しているので、第1及び第2端末を支配する第1及び第2NATルータのタイプとは無関係に、クライアント端末A,Bは直接通信できるようになる。したがって、本発明によれば、第1及び第2端末を支配する第1及び第2NATルータがどのようなタイプであっても、第1及び第2NATルータのタイプを判定する処理も必要とせず、第1及び第2端末は、サーバへの送信に使った送信元ポート番号を変更するだけで、直接通信ができるようになる。   In the present invention configured as described above, prior to the direct communication between the first and second terminals, the first and second transmission means of the first and second terminals first send the source port to the other party, respectively. Send data to the server to notify the number. The server notifies the second and first terminals of the port number based on the transmission source port number used for data transmission by the first and second transmission means, respectively. In the first and second terminals, the first and second port number receiving means receive the port numbers notified from the server, respectively, and the first and second trial means are based on the first and second transmitting means. By using a transmission source port number different from the transmission source port number used for data transmission and transmitting the data with the port number based on the received port number as the destination port number, the data is transmitted to the second and first terminals. Try each connection. In this case, if the transmission source port number is changed, both NAT routers have a property of changing the transmission source port number according to a certain rule. Therefore, the first and second terminals that control the first and second terminals are used. Regardless of the type of 2NAT router, the client terminals A and B can communicate directly. Therefore, according to the present invention, no matter what type the first and second NAT routers dominate the first and second terminals, the process of determining the type of the first and second NAT routers is not required, The first and second terminals can communicate directly only by changing the transmission source port number used for transmission to the server.

さらに、本発明の実施にあたっては、通信システム及び端末装置の発明に限定されることなく、通信システムに適用される通信方法の発明、端末装置に適用される通信方法及びコンピュータプログラムの発明としても実施し得るものである。   Furthermore, the embodiment of the present invention is not limited to the invention of the communication system and the terminal device, but is also implemented as an invention of a communication method applied to the communication system, a communication method applied to the terminal device, and an invention of a computer program. It is possible.

NATルータの振舞いパターンのうちのパターン1であるエンドポイント非依存マッピングの一例を説明するための図である。It is a figure for demonstrating an example of the end point independent mapping which is the pattern 1 of the behavior patterns of a NAT router. NATルータの振舞いパターンのうちのパターン2であるアドレス依存マッピングの一例を説明するための図である。It is a figure for demonstrating an example of the address dependence mapping which is the pattern 2 of the behavior patterns of a NAT router. NATルータの振舞いパターンのうちのパターン3であるアドレス&ポート番号依存マッピングの一例を説明するための図である。It is a figure for demonstrating an example of the address & port number dependence mapping which is the pattern 3 among the behavior patterns of a NAT router. NATルータの配下にある2つの端末間の通信における問題点を説明するための図である。It is a figure for demonstrating the problem in communication between the two terminals under the NAT router. この発明の一実施形態によるネットワークセッションシステムの構成例を示す。1 shows a configuration example of a network session system according to an embodiment of the present invention. PC1,2(クライアントA,B)からサーバへの通信態様を示す。A communication mode from the PCs 1 and 2 (clients A and B) to the server is shown. サーバからPC1,2(クライアントA,B)への通信態様を示す。A communication mode from the server to PCs 1 and 2 (clients A and B) is shown. PC1,PC2(クライアントA,B)間の通信態様を示す。A communication mode between PC1 and PC2 (clients A and B) is shown. この発明の一実施形態によるクライアント端末の接続動作例を示すフローチャートである。It is a flowchart which shows the example of a connection operation | movement of the client terminal by one Embodiment of this invention. この発明の一実施形態によるサーバの接続援助動作例を示すフローチャートである。It is a flowchart which shows the connection assistance operation example of the server by one Embodiment of this invention.

〔システム構成の概要〕
図3は、この発明の一実施形態によるネットワークセッションシステムの構成を示す。このネットワークセッションシステムは、セッション管理サーバ(単にサーバともいう)SVと、複数のNATルータNR:NRa〜NRd(記号“NR”はNATルータを代表的に表わす)と、各NATルータNRの配下にある各セッション端末TM:TMa〜TMd(記号“TM”はセッション端末を代表的に表わす)とで構成される通信システムである。これらのセッション管理サーバSV、複数のNATルータNR:NRa〜NRd、及びセッション端末TM:TMa〜TMdは、インターネットのような広域通信ネットワークCNを介して通信可能に接続されている。
[Overview of system configuration]
FIG. 3 shows a configuration of a network session system according to an embodiment of the present invention. This network session system includes a session management server (also simply referred to as a server) SV, a plurality of NAT routers NR: NRa to NRd (the symbol “NR” representatively represents a NAT router), and subordinates of each NAT router NR. Each of the session terminals TM: TMa to TMd (symbol “TM” representatively represents a session terminal) is a communication system. The session management server SV, the plurality of NAT routers NR: NRa to NRd, and the session terminals TM: TMa to TMd are communicably connected via a wide area communication network CN such as the Internet.

セッション管理サーバSVは、NAT配下にはなく、メンバーとなるセッション端末TM間の接続支援、例えば、セッションの開始に先立って行われる各セッション端末TM同士の接続手続きなどを行う。各セッション端末TM間、例えば、セッション端末TMa〜TMd間で接続が成立した後は、セッション管理サーバSVを介することなく、NAT配下のこれらセッション端末TMa〜TMd間において、直接、オーディオデータなどの演奏情報が送受信される。   The session management server SV is not under the NAT but performs connection support between the session terminals TM as members, for example, a connection procedure between the session terminals TM performed before the start of the session. After connection is established between the session terminals TM, for example, between the session terminals TMa to TMd, the performance of audio data or the like is directly performed between the session terminals TMa to TMd under the NAT without using the session management server SV. Information is sent and received.

NATルータNRは、図示されたセッション端末TMの外に、複数のホスト機器を配下に備え、これらの機器で構成されるローカルネットワークと広域通信ネットワークCNとの間でデータを中継し、両ネットワーク間でアドレス及びポート番号を変換するNAT機能を備える。すなわち、NATルータNRは、適当に割り振られ各ローカルネットワークでのみ通用するローカルなアドレス及びポート番号と、広域通信ネットワークCN上のグローバルなアドレス及びポート番号とを自動的に相互変換する。このNAT機能のタイプは、図1A〜図1Cで説明したように、パターン1〜3の3つが知られている。   The NAT router NR is provided with a plurality of host devices in addition to the illustrated session terminal TM, relays data between a local network constituted by these devices and the wide area communication network CN, and between the two networks. A NAT function for converting an address and a port number is provided. That is, the NAT router NR automatically converts between a local address and port number that are appropriately allocated and used only in each local network, and a global address and port number on the wide area communication network CN. Three types of NAT functions are known as described above with reference to FIGS. 1A to 1C.

ネットワーク音楽セッションのメンバーとなる複数のセッション端末TMa〜TMdは、クライアント端末又は単にクライアントとも呼ばれ、それぞれ、楽器演奏及び/又はカラオケが可能な電子音楽装置である。つまり、各セッション端末TMは、電子的な音楽情報処理機能を有する一種のコンピュータであり、電子楽器や音楽情報処理アプリケーションがインストールされたパーソナルコンピュータ(PC)のような電子音楽装置を用いることができる。また、セッション端末TMとして電子楽器を使用しカラオケを行わない場合があり、セッション端末TMとして音楽情報処理アプリケーション付きPCを使用しカラオケのみを行う場合もある。なお、セッション端末TMの数(メンバー数)は、図3には4つ例示されているが、これに限らず、4つより多くてもよいし、少なくてもよい。   A plurality of session terminals TMa to TMd that are members of a network music session are also called client terminals or simply clients, and are electronic music apparatuses capable of playing musical instruments and / or karaoke, respectively. That is, each session terminal TM is a kind of computer having an electronic music information processing function, and an electronic music device such as a personal computer (PC) in which an electronic musical instrument or a music information processing application is installed can be used. . Further, there are cases where an electronic musical instrument is used as the session terminal TM and karaoke is not performed, and there is a case where only a karaoke is performed using a PC with a music information processing application as the session terminal TM. Although the number of session terminals TM (number of members) is four in FIG. 3, the number is not limited to this, and may be more or less than four.

〔変換後のアドレス・ポート番号の取得までの手順〕
この発明の一実施形態による通信システムは、異なるNATルータNRa〜NRdの配下にある複数のセッション端末(以下、「クライアント端末」又は単に「クライアント」若しくは「端末」という)TMa〜TMdと、NAT配下にないセッション管理サーバ(以下、単に「サーバ」という)SVとから成り、各クライアント端末TMa〜TMdは、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、それぞれのNATルータNRa〜NRdを介して直接通信が行われる。しかしながら、図2を用いて説明したように、或るクライアント端末TMが属するNATルータNRが、宛先ポート番号が変わっただけで異なる送信元ポート番号の変換を行うパターン3(アドレス&ポート番号依存マッピング)のタイプ(図1C参照)であっても、端末TMa〜TMd間では、通信(接続)を確立させる必要がある。図4A乃至図4Cは、この発明の一実施形態による2クライアント端末間の交信に到るまでの手順を示す。なお、以下においては、クライアント(A)TMaとクライアント端末(B)TMbとの間で接続を確立する場合を例にして説明する。なお、下記説明では、クライアント(A)TMaをPC1とし、クライアント端末(B)TMbをPC2として説明する。
[Procedure to obtain the converted address and port number]
A communication system according to an embodiment of the present invention includes a plurality of session terminals (hereinafter referred to as “client terminals” or simply “clients” or “terminals”) TMa to TMd under the control of different NAT routers NRa to NRd, Each client terminal TMa-TMd uses a source address, a source port number, a destination address, and a destination port number, and each NAT router uses a session management server (hereinafter simply referred to as “server”) SV. Direct communication is performed via NRa to NRd. However, as described with reference to FIG. 2, the NAT router NR to which a certain client terminal TM belongs changes pattern 3 (address & port number dependent mapping) in which a different source port number is converted only by changing the destination port number. ) Type (see FIG. 1C), it is necessary to establish communication (connection) between the terminals TMa to TMd. 4A to 4C show a procedure up to communication between two client terminals according to an embodiment of the present invention. In the following, a case where a connection is established between the client (A) TMa and the client terminal (B) TMb will be described as an example. In the following description, the client (A) TMa is described as PC1 and the client terminal (B) TMb is described as PC2.

PC1,2間の直接通信に先立って、まず、図4Aに示すように、PC1は、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5000」すなわちサーバSVにパケット(データ)を送信する。PC2も、「送信元アドレス:192.168.0.1」及び「送信元ポート番号:5000」を使って、「宛先アドレス:2.2.2.2」及び「宛先ポート番号:5000」すなわちサーバSVにパケットを送信する。サーバSVは、PC1,PC2からのパケットを受け取り、PC1を配下とするNATルータによる変換結果である「送信元アドレス:1.1.1.1」及び「送信元ポート番号:30000」を確認するともに、PC2を配下とするNATルータによる変換結果である「送信元アドレス:3.3.3.1」及び「送信元ポート番号:40000」を確認する。   Prior to direct communication between the PCs 1 and 2, first, as shown in FIG. 4A, the PC 1 uses “source address: 192.168.0.1” and “source port number: 5000” to “ Destination address: 2.2.2.2 ”and“ destination port number: 5000 ”, that is, a packet (data) is transmitted to server SV. The PC 2 also uses the “source address: 192.168.0.1” and “source port number: 5000” to “destination address: 2.2.2.2” and “destination port number: 5000”, A packet is transmitted to the server SV. The server SV receives the packets from PC1 and PC2, and confirms “transmission source address: 1.1.1.1” and “transmission source port number: 30000”, which are the translation results by the NAT router under the control of PC1. In both cases, “transmission source address: 3.3.3.1” and “transmission source port number: 40000”, which are the conversion results by the NAT router under the control of PC2, are confirmed.

次に、サーバSVは、図4Bに示すように、確認したPC1に関する「送信元アドレス:1.1.1.1」をPC1のアドレスとして決定するとともに、確認したPC1に関する「送信元ポート番号:30000」に「+1」を加算した「ポート番号:30001」をPC1のポート番号として推測する。そして、サーバSVは,PC2に対して、「PC1のアドレスは『1.1.1.1』であり、PC1のポート番号はおそらく『30001』である」ことを通知する。また、サーバSVは、確認したPC2に関する「送信元アドレス:3.3.3.3」をPC2のアドレスとして決定するとともに、確認したPC2に関する「送信元ポート番号:40000」に「+1」を加算した「ポート番号:40001」をPC2のポート番号として推測する。そして、サーバSVは,PC1に対して、「PC2のアドレスは『3.3.3.3』であり、PC1のポート番号はおそらく『40001』である」ことを通知する。PC1,PC2は、これらの通知をそれぞれ受け取る。   Next, as shown in FIG. 4B, the server SV determines “source address: 1.1.1.1” regarding the confirmed PC 1 as the address of the PC 1 and “source port number: “Port number: 30001” obtained by adding “+1” to “30000” is estimated as the port number of PC1. Then, the server SV notifies the PC 2 that “the address of the PC 1 is“ 1.1.1.1 ”and the port number of the PC 1 is probably“ 30001 ””. Further, the server SV determines “source address: 3.3.3.3” relating to the confirmed PC 2 as the address of the PC 2 and adds “+1” to “source port number: 40000” relating to the confirmed PC 2. The estimated “port number: 40001” is estimated as the port number of PC2. Then, the server SV notifies the PC 1 that “the address of the PC 2 is“ 3.3.3.3 ”and the port number of the PC 1 is probably“ 40001 ””. PC1 and PC2 receive these notifications, respectively.

次に、PC1は、図4Cに示すように、前述したサーバにパケットを送信したときに使った「送信元ポート番号:5000」とは異なる「送信元ポート番号:5001」を確保する。そして、PC1は、「送信元アドレス:192.168.0.1」及び前記確保した「送信元ポート番号:5001」を使って、サーバから通知された「宛先アドレス:3.3.3.3」及び「宛先ポート番号:40001」すなわちPC2にパケットを送信する。一方、PC2も、前述したサーバにパケットを送信したときに使った「送信元ポート番号:5000」とは異なる「送信元ポート番号:5001」を確保する。そして、PC2は、「送信元アドレス:192.168.0.1」及び前記確保した「送信元ポート番号:5001」を使って、サーバから通知された「宛先アドレス:1.1.1.1」及び「宛先ポート番号:30001」すなわちPC1にパケットを送信する。なお、前記例では、前回使った送信元ポート番号に「+1」を加算することにより送信元ポート番号を変更したが、前回使った送信元ポート番号と異なれば、他の送信元ポート番号を使ってもよい。   Next, as shown in FIG. 4C, the PC 1 secures a “transmission source port number: 5001” different from the “transmission source port number: 5000” used when the packet is transmitted to the server described above. Then, the PC 1 uses the “source address: 192.168.0.1” and the secured “source port number: 5001” to notify the “destination address: 3.3.3.3” notified from the server. And “destination port number: 40001”, that is, the packet is transmitted to the PC 2. On the other hand, the PC 2 also secures a “source port number: 5001” different from the “source port number: 5000” used when the packet is transmitted to the server described above. Then, the PC 2 uses the “source address: 192.168.0.1” and the secured “source port number: 5001” to notify the “destination address: 1.1.1.1” notified from the server. And “destination port number: 30001”, that is, the packet is transmitted to PC1. In the above example, the transmission source port number is changed by adding “+1” to the transmission source port number used last time. However, if the transmission source port number is different from the previous transmission source port number, another transmission source port number is used. May be.

この場合、PC1,PC2を配下とするNATルータは、前回使われた送信元ポート番号と異なる送信元ポート番号が使われると、前述したパターン1〜3とは無関係に、前回変換した送信元ポート番号を変更する性質を有する。この送信元ポート番号の変更は、通常、シーケンシャルに変換される(すなわち、一つ前の変換結果に「+1」が加算される)。したがって、PC1,PC2のポート番号が一致し、PC1,PC2は互いに通信することができるようになる。   In this case, if the NAT router under the control of PC1 and PC2 uses a source port number different from the source port number used last time, the source port converted last time is used regardless of the patterns 1 to 3 described above. Has the property of changing the number. This change in the source port number is normally converted sequentially (that is, “+1” is added to the previous conversion result). Therefore, the port numbers of PC1 and PC2 match, and PC1 and PC2 can communicate with each other.

〔動作例〕
次に、具体的な動作例について説明する。図5はこの発明の一実施形態によるクライアント端末TMの接続動作例を示し、図6はこの発明の一実施形態によるサーバSVの接続援助動作例を示す。言い換えれば、図5は、クライアント端末TMのCPUによって実行される、接続動作例に係るコンピュータプログラムのフローチャートを示している。図6は、サーバSVのCPUによって実行される、接続援助動作例に係るコンピュータプログラムのフローチャートを示している。
[Operation example]
Next, a specific operation example will be described. FIG. 5 shows a connection operation example of the client terminal TM according to one embodiment of the present invention, and FIG. 6 shows a connection assistance operation example of the server SV according to one embodiment of the present invention. In other words, FIG. 5 shows a flowchart of the computer program according to the connection operation example executed by the CPU of the client terminal TM. FIG. 6 shows a flowchart of a computer program according to a connection assistance operation example executed by the CPU of the server SV.

まず、ユーザ操作による接続開始の指示があると、クライアント端末TM(制御部であるCPU)は、図5に示すプログラムの実行を開始し、ステップC1にてサーバSVに対して接続を行うことを通知する。次に、クライアント端末TMは、ステップC2にてサーバSVから接続開始の指示が届いたか否か、すなわち、他の参加者が現れたかどうかを判定する。サーバSVから接続開始の指示が届いていない場合には、クライアント端末TMは、ステップC2にて「No」と判定し、ステップC2の処理を繰り返し実行して接続開始の指示の到着を待つ。なお、前記説明では、一つのクライアント端末TMのサーバSVに対する接続の通知について説明したが、この状態では、相互に通信する他のクライアント端末TMも、前記ステップC1,C2の処理を行っている。以降のクライアント端末TMの動作においても、相互に通信する複数のクライアント端末TMが図5に示すプログラム処理をそれぞれ実行する。   First, when there is an instruction to start connection by a user operation, the client terminal TM (CPU as the control unit) starts executing the program shown in FIG. 5 and performs connection to the server SV in step C1. Notice. Next, the client terminal TM determines whether or not a connection start instruction has been received from the server SV in Step C2, that is, whether or not another participant has appeared. If the connection start instruction has not arrived from the server SV, the client terminal TM determines “No” in Step C2, and repeats the process of Step C2 to wait for the arrival of the connection start instruction. In the above description, the connection notification of one client terminal TM to the server SV has been described. In this state, the other client terminals TM communicating with each other are also performing the processes of steps C1 and C2. Also in the subsequent operation of the client terminal TM, the plurality of client terminals TM communicating with each other execute the program processing shown in FIG.

一方、サーバSVは、図6に示すプログラムの実行を開始し、ステップS1にて、前記ステップC1の処理によるクライアント端末TMから接続の通知が届いたか否かを判定する。接続の通知が届いていない状態では、サーバSVは、ステップS1にて「No」と判定して、クライアント端末TMからの接続の通知を待つ。そして、一つのクライアント端末TMから接続の通知が届くと、サーバSVは、ステップS1にて「Yes」と判定して、ステップS2に進む。サーバSVは、ステップS2にて接続待ちのクライアント端末TMが2つ以上存在するか否か(他の参加者が現れたどうか)を判定する。接続待ちのクライアント端末TMが2つ以上存在しなければ、サーバSVは、ステップS2にて「No」と判定して、前記ステップS1に戻って、他のクライアント端末TMからの接続の通知を再び待つ。そして、このようなステップS1,S2の処理を繰返す。なお、この場合、2つのクライアント端末TMからの接続の通知が届いた時点で、ステップS2にて「Yes」と判定される。しかし、3つ以上のクライアント端末TMが存在することもあるので、サーバSVは、一つのクライアント端末TMからの接続の通知からステップS2にて「Yes」と判定するまでに多少の時間を待つようにするとよい。そして、この待ち時間の間、サーバSVは、ステップS2にて「No」と判定し続けて、ステップS1,S2の処理を繰り返す。   On the other hand, the server SV starts execution of the program shown in FIG. 6, and determines in step S1 whether or not a notification of connection has arrived from the client terminal TM by the processing in step C1. In a state where the connection notification has not arrived, the server SV determines “No” in step S1, and waits for a connection notification from the client terminal TM. When a connection notification is received from one client terminal TM, the server SV determines “Yes” in step S1, and proceeds to step S2. The server SV determines whether there are two or more client terminals TM waiting for connection in step S2 (whether other participants have appeared). If there are not two or more client terminals TM waiting for connection, the server SV determines “No” in step S2, returns to the step S1, and again notifies the connection from the other client terminals TM. wait. Then, the processes in steps S1 and S2 are repeated. In this case, when the notification of connection from the two client terminals TM arrives, “Yes” is determined in step S2. However, since there may be more than two client terminals TM, the server SV waits for some time before determining “Yes” in step S2 from the notification of connection from one client terminal TM. It is good to make it. During this waiting time, the server SV continues to determine “No” in step S2 and repeats the processes in steps S1 and S2.

そして、接続待ちのクライアント端末TMが2つ以上存在して、前記ステップS2にて「Yes」と判定されると、サーバSVは、ステップS3にて、接続待ちの全てクライアント端末TMに対して接続開始の指示を送信する。前記ステップS3の処理後、サーバSVは、ステップS4にて、接続開始を指示した全てのクライアント端末TMからポート番号P1へのパケットを受信したか否かを判定する。全てのクライアント端末TMからポート番号P1へのパケットを受信しない状態では、サーバSVは、ステップS4にて「No」と判定して、前記パケットの受信を待つ。   If there are two or more client terminals TM waiting for connection and it is determined “Yes” in step S2, the server SV connects to all client terminals TM waiting for connection in step S3. Send start instructions. After the processing in step S3, the server SV determines in step S4 whether or not packets for the port number P1 have been received from all client terminals TM instructed to start connection. In a state where packets from all client terminals TM to the port number P1 are not received, the server SV determines “No” in step S4 and waits for reception of the packets.

一方、接続開始の指示待ちの各クライアント端末TMは、前記ステップC2の待機中、サーバSVからの接続開始の指示が送信されると、ステップC2にて接続開始の指示を受信して「Yes」と判定し、ステップC3に進む。ステップC3においては、各クライアント端末TMは、所定の送信元アドレス及び送信元ポート番号を使って、サーバSVに対してポート番号P1宛てにパケットを送信する。前記ステップC3の処理後、各クライアント端末TMは、ステップC4にてサーバSVから接続先のポート番号とアドレスの通知が届いたかを判定する。そして、接続先のポート番号とアドレスの通知が届くまで、各クライアント端末TMは、ステップC4にて「No」と判定し続けて、接続先のポート番号とアドレスの通知を待つ。   On the other hand, each client terminal TM waiting for a connection start instruction receives a connection start instruction in step C2 and receives a “Yes” when a connection start instruction is transmitted from the server SV while waiting in step C2. And proceed to Step C3. In step C3, each client terminal TM transmits a packet to the port number P1 to the server SV using a predetermined transmission source address and transmission source port number. After the process of step C3, each client terminal TM determines whether a notification of the port number and address of the connection destination has arrived from the server SV in step C4. Each client terminal TM continues to make a “No” determination in step C4 and waits for a notification of the connection destination port number and address until notification of the connection destination port number and address arrives.

前記パケートの受信を待っているサーバSVは、ステップS4にて、クライアント端末TMからのパケットの送信があるごとに、送信されたパケットを受信する。そして、サーバSVは、接続が通知された全てのクライアント端末TMからポート番号P1へのパケットを受信すると、ステップS4にて「Yes」と判定して、ステップS5に進む。ステップS5においては、サーバSVは、全てのクライアント端末TMに相手の接続先アドレスと推測ポート番号の通知を送信する。具体的には、サーバSVは、各クライアント端末TMから受信したパケットの送信元ポート番号に「+1」を加算することにより推測ポート番号を求めて、前記受信したパケットの送信元アドレス及び推測ポート番号を全てのクライアント端末TMに送信する。   The server SV waiting for reception of the packet receives the transmitted packet every time a packet is transmitted from the client terminal TM in step S4. When the server SV receives packets from all the client terminals TM notified of connection to the port number P1, the server SV determines “Yes” in step S4, and proceeds to step S5. In step S5, the server SV transmits a notification of the other party's connection destination address and the estimated port number to all the client terminals TM. Specifically, the server SV obtains an estimated port number by adding “+1” to the transmission source port number of the packet received from each client terminal TM, and the transmission source address and the estimated port number of the received packet. Is transmitted to all the client terminals TM.

次に、サーバSVは、ステップS6にて、クライアント端末TMから、「接続完了」、「接続のリトライ通知」及び「接続失敗」の何れかのパケットが届いたか否かを判定する。前記パケットが届いていなければ、サーバSVはステップS6にて「No」と判定して、前記パケットが届くのを待つ。なお、このステップS6の判定における「接続完了」に関しては、ステップS5の処理により接続開始の指示を送信した全てのクライアント端末TMから通知があったかを判定するのに対して、「接続のリトライ通知」及び「接続失敗」に関しては前記全てのクライアント端末TMのうちのいずれか一つのクライアント端末TMからの通知があったかを判定する。   Next, in step S6, the server SV determines whether any of the “connection complete”, “connection retry notification”, and “connection failure” packets has arrived from the client terminal TM. If the packet has not arrived, the server SV determines “No” in step S6 and waits for the packet to arrive. Regarding “connection completion” in the determination in step S6, it is determined whether or not there has been a notification from all the client terminals TM that transmitted a connection start instruction in the process in step S5, whereas “connection retry notification”. As for “connection failure”, it is determined whether there is a notification from any one of the client terminals TM.

一方、接続先のポート番号とアドレスの通知を待っている各クライアント端末TMは、サーバSVからの接続先アドレスと推測ポート番号が届くと、ステップC4にて、接続先アドレスと推測ポート番号を受信して「Yes」と判定して、ステップC5に進む。ステップC5においては、クライアント端末TMは、前記ステップC3でサーバSVにパケットを送信した際に使った送信元ポート番号とは異なる新たな送信元ポート番号を設定する。この場合、前記サーバSVにパケットを送信した際に使った送信元ポート番号に「+1」を加算することにより新たな送信元ポート番号を設定するが、前記サーバSVにパケットを送信した際に使った送信元ポート番号と異なれば、他の送信元ポート番号を設定してもよい。   On the other hand, each client terminal TM waiting for notification of the connection destination port number and address receives the connection destination address and the estimated port number in step C4 when the connection destination address and the estimated port number are received from the server SV. And it determines with "Yes" and progresses to step C5. In step C5, the client terminal TM sets a new source port number that is different from the source port number used when the packet is transmitted to the server SV in step C3. In this case, a new source port number is set by adding “+1” to the source port number used when the packet is transmitted to the server SV. However, this is used when the packet is transmitted to the server SV. If it is different from the source port number, another source port number may be set.

次に、クライアント端末TMは、ステップC6にて、前記ステップC3の場合と同じ所定の送信元アドレス及び前記新たに設定した送信元ポート番号を使い、サーバSVから通知された相手クライアント端末TMの推測ポート番号及びアドレスへ試行パケット(試行データ)を送信することにより、相手クライアント端末TMとの接続を試行する。   Next, in step C6, the client terminal TM uses the same predetermined source address and the newly set source port number as in step C3, and estimates the partner client terminal TM notified from the server SV. A connection with the partner client terminal TM is attempted by transmitting a trial packet (trial data) to the port number and address.

なお、前記のように、サーバSVから通知された相手クライアント端末TMの推測ポート番号及びアドレスのみを使って相手クライアント端末TMとの接続を試行するのではなく、クライアント端末TMは、前記通知された推測ポート番号の前後の複数のポート番号及び前記通知されたアドレスを使って前記接続を試行してもよい。前後のポート番号とは、例えば、通知された推測ポート番号に「+1」、「+2」、「+3」・・・をそれぞれ加算した数個のポート番号及び通知された推測ポート番号から「+1」、「+2」、「+3」・・・をそれぞれ減算した数個のポート番号である。これは、次の理由による。相手クライアント端末TMを支配するNATルータが上述したパターン1〜3のうちのいずれかのパターンであっても、相手クライアント端末TMを支配するNATルータのあるポートがたまたま使用中である場合には、NATルータNRは使用中でなくてサーバSVから通知された推測ポート番号の前後のポートに変更することがある。したがって、この場合には、前記通知された推測ポート番号の試行では、試行パケットは相手クライアント端末TMに届かないこともあるからである。   As described above, the client terminal TM is not notified of the connection with the partner client terminal TM using only the estimated port number and address of the partner client terminal TM notified from the server SV. The connection may be attempted using a plurality of port numbers before and after the estimated port number and the notified address. The port numbers before and after are, for example, “+1” from several port numbers obtained by adding “+1”, “+2”, “+3”... To the notified estimated port number and the notified estimated port number. , “+2”, “+3”,... This is due to the following reason. Even if the NAT router that controls the partner client terminal TM is one of the patterns 1 to 3 described above, if a port of the NAT router that controls the partner client terminal TM happens to be used, The NAT router NR is not in use and may be changed to a port before and after the estimated port number notified from the server SV. Therefore, in this case, the trial packet may not reach the partner client terminal TM in the trial of the notified estimated port number.

前記ステップC6の処理後、各クライアント端末TMは、ステップC7にて、接続しようとする相手クライアント端末TMからの試行パケットが届いたか否かを判定する。相手クライアント端末TMからの試行パケットが届かない状態では、各クライアント端末TMは、ステップC7にて「No」とそれぞれ判定して、ステップC8に進む。ステップC8においては、前記クライアント端末TMは、相手クライアント端末TMからのパケットを待つ最大時間が経過したか否かを判定する。そして、最大時間が経過していない間は、前記クライアント端末TMは、ステップC8にて「No」と判定して、ステップC7に戻り、相手クライアント端末TMからの試行パケットが届くまで或いは最大時間が経過するまで、ステップC7,C8の処理を繰返し実行する。   After the processing in step C6, each client terminal TM determines whether or not a trial packet from the partner client terminal TM to be connected has arrived in step C7. In a state where the trial packet from the partner client terminal TM has not arrived, each client terminal TM determines “No” in Step C7 and proceeds to Step C8. In step C8, the client terminal TM determines whether or not the maximum time for waiting for a packet from the partner client terminal TM has elapsed. While the maximum time has not elapsed, the client terminal TM makes a “No” determination at step C8 and returns to step C7 until the trial packet from the partner client terminal TM arrives or the maximum time The processes in steps C7 and C8 are repeatedly executed until the time has elapsed.

前記ステップC7,C8の循環処理中、試行パケットが届くと、各クライアント端末TMは、ステップC7にて「Yes」と判定して、ステップC9に進む。ステップC9においては、各クライアント端末TMは、サーバSVに接続完了したことを通知する。これにより、相手クライアント端末TMから試行パケットを受け取ったクライアント端末TMは、相手クライアント端末TMとの直接的な接続が確立し、この接続動作を終了する。なお、受け取った試行パケットは相手クライアント端末TMに関する送信元アドレス及び送信元ポート番号を含むので、試行パケットを受け取ったクライアント端末TMは相手クライアント端末TMのアドレスとポート番号を認識できる。以後、クライアント端末TMは、相手クライアント端末TMとの音楽セッション動作(合奏)に移行する。   When a trial packet arrives during the cyclic processing in steps C7 and C8, each client terminal TM determines “Yes” in step C7 and proceeds to step C9. In step C9, each client terminal TM notifies the server SV that the connection has been completed. As a result, the client terminal TM that has received the trial packet from the partner client terminal TM establishes a direct connection with the partner client terminal TM and ends this connection operation. Since the received trial packet includes a transmission source address and a transmission source port number relating to the partner client terminal TM, the client terminal TM that has received the trial packet can recognize the address and port number of the partner client terminal TM. Thereafter, the client terminal TM shifts to a music session operation (ensemble) with the partner client terminal TM.

一方、相手クライアント端末TMからの試行パケットが届かない状態で、最大時間が経過すると、各クライアント端末TMは、ステップC8にて「Yes」と判定して、ステップC10に進む。ステップC10においては、各クライアント端末TMは、ステップC6の処理によるパケット送信の試行を最大試行回数行ったか否かを判定する。最大試行回数行っていないときには、クライアント端末TMは、ステップC10にて「No」と判定して、ステップC11に進む。ステップC11においては、各クライアント端末TMは、サーバSVに接続のリトライを通知して、ステップC3に戻り、前述したステップC3〜C8,C10,C11からなる接続の再試行を繰返し実行する。そして、パケット送信の試行を最大試行回数行ったときには、各クライアント端末TMは、ステップC10にて「Yes」と判定して、ステップC12にてサーバSVに接続失敗したことを通知して接続を断念し、この接続動作を終了する。この場合、各クライアント端末TMは相手クライアント端末TMと接続ができなかったことになる。   On the other hand, when the maximum time has elapsed in a state where the trial packet from the partner client terminal TM has not arrived, each client terminal TM determines “Yes” in Step C8 and proceeds to Step C10. In step C10, each client terminal TM determines whether or not the maximum number of trials for packet transmission by the process of step C6 has been performed. When the maximum number of trials has not been performed, the client terminal TM determines “No” in Step C10 and proceeds to Step C11. In step C11, each client terminal TM notifies the server SV of a connection retry, returns to step C3, and repeatedly executes the connection retry including steps C3 to C8, C10, and C11 described above. When the maximum number of attempts for packet transmission is performed, each client terminal TM determines “Yes” in step C10, notifies the server SV that the connection has failed in step C12, and gives up the connection. Then, this connection operation is terminated. In this case, each client terminal TM cannot connect to the partner client terminal TM.

一方、前記ステップS6の繰り返し処理中のサーバSVは、クライアント端末TMから、「接続完了」、「接続のリトライ通知」及び「接続失敗」の何れかのパケットが届くと、ステップS6にて「Yes」と判定して、ステップS7に進む。ステップS7においては、サーバSVは、クライアント端末TMから届いた「接続完了」、「接続のリトライ通知」又は「接続失敗」に応じて分岐処理を実行する。   On the other hand, when the server SV that is repeatedly performing the process in step S6 receives from the client terminal TM one of the “connection complete”, “connection retry notification”, and “connection failure” packets, “Yes” in step S6. ”And proceed to step S7. In step S7, the server SV executes a branch process in response to “connection complete”, “connection retry notification”, or “connection failure” received from the client terminal TM.

この場合、「接続完了」のパケットを受信したときは、サーバSVは、ステップS8に進み、接続完了とし、パケットを受信したクライアント端末TMを接続待ちのクライアント端末TMから削除する。また、「接続のリトライ通知」のパケットを受信したときは、サーバSVは、ステップS3に戻って、前述したステップS3〜S7の処理を繰り返す。さらに、「接続失敗」のパケットを受信したときは、サーバSVは、ステップS9に進み、接続失敗とし、パケットを受信したクライアント端末TMを接続待ちのクライアント端末TMから削除する。そして、ステップS8,S9の処理後は、元の待機状態に戻る。   In this case, when receiving a “connection complete” packet, the server SV proceeds to step S8, completes the connection, and deletes the client terminal TM that has received the packet from the client terminal TM waiting for connection. When the “connection retry notification” packet is received, the server SV returns to step S3 and repeats the processes of steps S3 to S7 described above. Further, when the “connection failure” packet is received, the server SV proceeds to step S9, determines that the connection has failed, and deletes the client terminal TM that has received the packet from the client terminal TM waiting for connection. Then, after the processing of steps S8 and S9, the original standby state is restored.

以上説明したように、上記実施形態においては、両クライアント端末A,Bの直接通信に先立って、まず、クライアント端末A,BからサーバSVにパケットを送信し、サーバSVは、送信に使われた送信元ポート番号に「+1」だけ加算したポート番号を推測ポート番号にそれぞれ決定して、クライアント端末A,Bに相手方の送信元アドレス及び推測送信元ポート番号を通知する。その後、クライアント端末A,Bは、前記サーバSVへの送信時に使った送信元ポート番号とは異なる送信元ポート番号に変更すれば、サーバSVから通知された相手方のポート番号及び推測ポート番号を使って、互いに直接通信し合うことができる。すなわち、上記実施形態においては、送信元ポート番号が変更されると、NATルータA,Bは送信元ポート番号をシーケンシャルに変更するという性質を用いることにより、クライアント端末A,Bを支配するNATルータA,Bのタイプとは無関係に、クライアント端末A,Bは直接通信できるようになる。したがって、上記実施形態によれば、クライアント端末A,Bを支配するNATルータA,Bがどのようなタイプであっても、NATルータA,Bのタイプを判定する処理も必要とせず、クライアント端末A,Bは、サーバSVへの送信に使った送信元ポート番号を変更するだけで、直接通信ができるようになる。   As described above, in the above-described embodiment, prior to direct communication between both client terminals A and B, first, a packet is transmitted from the client terminals A and B to the server SV, and the server SV is used for transmission. The port number obtained by adding “+1” to the transmission source port number is determined as the estimated port number, and the other party's transmission source address and estimated transmission source port number are notified to the client terminals A and B. After that, if the client terminals A and B change the transmission source port number different from the transmission source port number used at the time of transmission to the server SV, the client terminal A and B will use the other party's port number and the estimated port number notified from the server SV. Can communicate directly with each other. In other words, in the above embodiment, the NAT routers A and B control the client terminals A and B by using the property that when the source port number is changed, the NAT routers A and B change the source port number sequentially. Regardless of the types of A and B, the client terminals A and B can communicate directly. Therefore, according to the above embodiment, no matter what type of NAT routers A and B dominate the client terminals A and B, it is not necessary to determine the type of NAT routers A and B. A and B can communicate directly only by changing the transmission source port number used for transmission to the server SV.

〔変形例〕
上記実施形態においては、図4B及び図6のステップS5において、サーバSVは、クライアント端末TMから送信されるとともにNATルータNRで変換されたクライアント端末TMの送信元ポート番号に「+1」を加算して、推測ポート番号として相手方のクライアント端末TMに送信するようにした。しかし、サーバSVは、クライアント端末TMから送信されるとともにNATルータNRで変換されたクライアント端末TMの送信元ポート番号そのものを、相手方のクライアント端末TMに送信するようにしてもよい。この場合、相手方のクライアント端末TMで、サーバSVから送信された送信元ポート番号そのものに、「+1」を加算したポート番号を宛先ポート番号として使うようにすればよい。また、サーバSVは、前記送信元ポート番号に「+1」を加算した推測ポート番号及び前記送信元ポート番号そのものでもなく、予め決められたルールを用いて変換された推測ポート番号をクライアント端末TMに通知し、クライアント端末TMは前記ルールに従って通知された推測ポート番号を変換したポート番号を宛先ポート番号としてもよい。
[Modification]
In the above embodiment, in step S5 of FIG. 4B and FIG. 6, the server SV adds “+1” to the transmission source port number of the client terminal TM transmitted from the client terminal TM and converted by the NAT router NR. Thus, the estimated port number is transmitted to the other client terminal TM. However, the server SV may transmit the source port number itself of the client terminal TM transmitted from the client terminal TM and converted by the NAT router NR to the client terminal TM of the other party. In this case, the partner client terminal TM may use a port number obtained by adding “+1” to the source port number itself transmitted from the server SV as the destination port number. Further, the server SV does not give the estimated port number obtained by adding “+1” to the transmission source port number and the transmission source port number itself, but the estimated port number converted using a predetermined rule to the client terminal TM. The client terminal TM may notify the port number obtained by converting the estimated port number notified in accordance with the rule as the destination port number.

また、上記実施形態においては、サーバSVは、パケットを送る際にNATルータNRで変換されて使われた送信元ポート番号に「+1」を加算したポート番号を推測ポート番号として決定して相手クライアント端末TMに通知するようにした。しかし、これに代えて、サーバSVは、NATルータNRの振舞い(送信元番号の変換態様)に応じて、「+1」以外の値である推測ポート番号の増減値(例えば、「+2」、「+3」・・・又は「−2」、「−3」・・・など)を決定するようにしてもよい。そして、クライアント端末TMから送られた送信元ポート番号に前記決定した増減値を加算したポート番号、又は前記送信元ポート番号から前記決定した増減値を減算したポート番号を推測ポート番号として決定して、相手クライアント端末TMに通知するようにしてもよい。これは、あるNATルータがシーケンシャルに送信元ポート番号を変換しないことも考えられるからである。   In the above embodiment, the server SV determines the port number obtained by adding “+1” to the source port number converted and used by the NAT router NR when sending the packet as the estimated port number, and determines the partner client. The terminal TM was notified. However, instead of this, the server SV increases or decreases the estimated port number (for example, “+2”, “+”), which is a value other than “+1”, according to the behavior of the NAT router NR (transmission source number conversion mode). +3 "... or" -2 "," -3 "..., etc.) may be determined. The port number obtained by adding the determined increase / decrease value to the transmission source port number sent from the client terminal TM or the port number obtained by subtracting the determined increase / decrease value from the transmission source port number is determined as the estimated port number. The partner client terminal TM may be notified. This is because a certain NAT router may not convert the source port number sequentially.

さらに、上記実施形態においては、図4B及び図6のステップS5にて、サーバSVは、接続先アドレス及び接続先の推測ポート番号を、全てのクライアント端末TMに同時に通知するようにした。しかし、サーバSVは、接続先アドレスに関しては、両クライアント端末TMに推測ポート番号とは別に通知するようにしてもよい。また、全てのクライアント端末TMが互いに接続先アドレスを事前に認識している場合には、図4B及び図6のステップS5にて、サーバSVは、接続先の推測ポート番号のみを全てのクライアント端末TMに通知するようにしてもよい。   Furthermore, in the above embodiment, in step S5 of FIG. 4B and FIG. 6, the server SV notifies all the client terminals TM of the connection destination address and the estimated port number of the connection destination at the same time. However, the server SV may notify both client terminals TM of the connection destination address separately from the estimated port number. If all the client terminals TM recognize the connection destination addresses in advance, in step S5 in FIG. 4B and FIG. 6, the server SV assigns only the estimated port number of the connection destination to all the client terminals. You may make it notify TM.

NR:NRa〜NRd…NATルータ、TM:TMa〜TMd…セッション端末(クライアント端末)、SV…セッション管理サーバ、CN…広域通信ネットワーク NR: NRa to NRd ... NAT router, TM: TMa to TMd ... session terminal (client terminal), SV ... session management server, CN ... wide area communication network

Claims (8)

第1NATルータの配下にある第1端末と、第2NATルータの配下にある第2端末と、NATルータの配下にないサーバとから成り、前記第1端末及び前記第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、前記第1NATルータ及び前記第2NATルータを介して互いに通信する通信システムにおいて、
前記サーバは、前記第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を前記第2端末に通知するとともに、前記第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を前記第1端末に通知し、
前記第1端末は、
前記第2端末に送信元ポート番号を通知するために前記サーバにデータを送信する第1送信手段と、
前記サーバから通知された前記第2端末に関するポート番号を受信する第1ポート番号受信手段と、
前記第1送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記第1ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行する第1試行手段とを備え、かつ
前記第2端末は、
前記第1端末に送信元ポート番号を通知するために前記サーバにデータを送信する第2送信手段と、
前記サーバから通知された前記第1端末に関するポート番号を受信する第2ポート番号受信手段と、
前記第2送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記第2ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行する第2試行手段とを備えたことを特徴とする通信システム。
A first terminal under the first NAT router, a second terminal under the second NAT router, and a server not under the NAT router, wherein the first terminal and the second terminal have a source address, In a communication system that communicates with each other via the first NAT router and the second NAT router using a source port number, a destination address, and a destination port number,
The server notifies the second terminal of a port number based on a transmission source port number used for data transmission to notify the transmission source port number by the first terminal, and transmits the transmission source by the second terminal. Notifying the first terminal of a port number based on a source port number used for data transmission to notify the port number;
The first terminal is
First transmitting means for transmitting data to the server to notify the second terminal of a source port number;
First port number receiving means for receiving a port number related to the second terminal notified from the server;
A transmission source port number different from the transmission source port number used for data transmission by the first transmission means is used, and the port number based on the port number received by the first port number reception means is used as a destination port number. First trial means for trying to connect to the second terminal by transmitting, and the second terminal,
Second transmission means for transmitting data to the server to notify the first terminal of a source port number;
Second port number receiving means for receiving a port number related to the first terminal notified from the server;
A transmission source port number different from the transmission source port number used for data transmission by the second transmission means is used, and the port number based on the port number received by the second port number reception means is used as a destination port number. A communication system comprising: second trial means for trying to connect to the second terminal by transmitting.
請求項1に記載の通信システムにおいて、
前記サーバは、さらに、前記第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元アドレスを前記第2端末に通知するとともに、前記第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元アドレスを前記第1端末に通知し、
前記第1端末の前記第1ポート番号受信手段は、さらに、前記サーバから通知された前記第2端末の送信元アドレスを受信し、
前記第1端末の前記第1試行手段は、さらに、前記第1ポート番号受信手段により受信した送信元アドレスも使って前記第2端末への接続を試行し、
前記第2端末の前記第2ポート番号受信手段は、さらに、前記サーバから通知された前記第1端末の送信元アドレスを受信し、
前記第2端末の前記第2試行手段は、さらに、前記第2ポート番号受信手段により受信した送信元アドレスも使って前記第1端末への接続を試行する通信システム。
The communication system according to claim 1,
The server further notifies the second terminal of a source address used for data transmission to notify the source port number by the first terminal, and sets the source port number by the second terminal. Notifying the first terminal of the source address used to transmit the data for notification,
The first port number receiving means of the first terminal further receives the source address of the second terminal notified from the server;
The first trial means of the first terminal further attempts to connect to the second terminal using the source address received by the first port number receiving means,
The second port number receiving means of the second terminal further receives the source address of the first terminal notified from the server;
The communication system in which the second trial unit of the second terminal further attempts to connect to the first terminal using the source address received by the second port number reception unit.
請求項1又は2に記載の通信システムにおいて、
前記サーバは、前記第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に「+1」を加算したポート番号を前記第2端末に通知するとともに、前記第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に「+1」を加算したポート番号を前記第1端末に通知し、
前記第1端末の第1試行手段は、前記第1ポート番号受信手段により受信したポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行し、かつ
前記第2端末の第2試行手段は、前記第2ポート番号受信手段により受信したポート番号を宛先ポート番号としてデータを送信することにより前記第1端末への接続を試行する通信システム。
The communication system according to claim 1 or 2,
The server notifies the second terminal of a port number obtained by adding “+1” to the transmission source port number used for data transmission to notify the transmission source port number by the first terminal. 2 notifies the first terminal of the port number obtained by adding “+1” to the source port number used for data transmission to notify the source port number by the two terminals;
The first trial unit of the first terminal tries to connect to the second terminal by transmitting data using the port number received by the first port number receiving unit as a destination port number, and the second terminal The second trial means attempts to connect to the first terminal by transmitting data using the port number received by the second port number receiving means as the destination port number.
請求項1又は2に記載の通信システムにおいて、
前記サーバは、前記第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号を前記第2端末に通知するとともに、前記第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号を前記第1端末に通知し、
前記第1端末の第1試行手段は、前記第1ポート番号受信手段により受信した送信元ポート番号に「+1」を加算したポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行し、かつ
前記第2端末の第2試行手段は、前記第2ポート番号受信手段により受信した送信元ポート番号に「+1」を加算したポート番号を宛先ポート番号としてデータを送信することにより前記第1端末への接続を試行する通信システム。
The communication system according to claim 1 or 2,
The server notifies the second terminal of the source port number used for data transmission to notify the source port number by the first terminal, and notifies the source port number by the second terminal. To notify the first terminal of the source port number used to transmit the data,
The first trial unit of the first terminal transmits data to the second terminal by transmitting data using a port number obtained by adding “+1” to the source port number received by the first port number receiving unit as a destination port number. And the second trial unit of the second terminal transmits data using the port number obtained by adding “+1” to the source port number received by the second port number receiving unit as the destination port number. A communication system that attempts to connect to the first terminal.
第1NATルータの配下にある第1端末と、第2NATルータの配下にある第2端末と、NATルータの配下にないサーバとから成り、前記第1端末及び前記第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、前記第1NATルータ及び前記第2NATルータを介して互いに通信する通信方法において、
前記サーバは、前記第1端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を前記第2端末に通知するとともに、前記第2端末によって送信元ポート番号を通知するためにデータの送信に使われた送信元ポート番号に基づくポート番号を前記第1端末に通知し、
前記第1端末は、
前記第2端末に送信元ポート番号を通知するために前記サーバにデータを送信し、
前記サーバから通知された前記2端末に関するポート番号を受信し、
前記サーバへのデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記受信した第2端末に関するポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行し、かつ
前記第2端末は、
前記第1端末に送信元ポート番号を通知するために前記サーバにデータを送信し、
前記サーバから通知された前記1端末に関するポート番号を受信し、
前記サーバへのデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記受信した第1端末に関するポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行することを特徴とする通信方法。
A first terminal under the first NAT router, a second terminal under the second NAT router, and a server not under the NAT router, wherein the first terminal and the second terminal have a source address, In a communication method of communicating with each other via the first NAT router and the second NAT router using a source port number, a destination address, and a destination port number,
The server notifies the second terminal of a port number based on a transmission source port number used for data transmission to notify the transmission source port number by the first terminal, and transmits the transmission source by the second terminal. Notifying the first terminal of a port number based on a source port number used for data transmission to notify the port number;
The first terminal is
Sending data to the server to notify the second terminal of the source port number;
Receiving the port number regarding the two terminals notified from the server;
By using a transmission source port number different from the transmission source port number used for transmission of data to the server, and transmitting the data with the port number based on the received port number related to the second terminal as the destination port number, Trying to connect to a second terminal, and the second terminal
Sending data to the server to notify the first terminal of the source port number;
Receiving the port number related to the one terminal notified from the server;
By using a transmission source port number different from the transmission source port number used for transmitting data to the server, and transmitting the data with the port number based on the received port number relating to the first terminal as the destination port number, A communication method characterized by trying to connect to a second terminal.
第1NATルータの配下にある第1端末と、第2NATルータの配下にある第2端末と、NATルータの配下にないサーバとから成り、前記第1端末及び前記第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、前記第1NATルータ及び前記第2NATルータを介して互いに通信する通信システムにおける前記第1端末を構成する端末装置であって、
前記第2端末に送信元ポート番号を通知するために前記サーバにデータを送信する送信手段と、
前記サーバから通知された前記第2端末に関するポート番号を受信するポート番号受信手段と、
前記送信手段によるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記ポート番号受信手段により受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行する試行手段とを備えたことを特徴とする端末装置。
A first terminal under the first NAT router, a second terminal under the second NAT router, and a server not under the NAT router, wherein the first terminal and the second terminal have a source address, A terminal device constituting the first terminal in a communication system that communicates with each other via the first NAT router and the second NAT router using a source port number, a destination address, and a destination port number,
Transmitting means for transmitting data to the server to notify the second terminal of the source port number;
Port number receiving means for receiving a port number related to the second terminal notified from the server;
By using a transmission source port number different from the transmission source port number used for data transmission by the transmission means, and transmitting data using the port number based on the port number received by the port number reception means as the destination port number A terminal device comprising trial means for trying to connect to the second terminal.
第1NATルータの配下にある第1端末と、第2NATルータの配下にある第2端末と、NATルータの配下にないサーバとから成り、前記第1端末及び前記第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、前記第1NATルータ及び前記第2NATルータを介して互いに通信する通信システムにおける前記第1端末を構成する端末装置の通信方法であって、
前記第2端末に送信元ポート番号を通知するために前記サーバにデータを送信し、
前記サーバから通知された前記第2端末に関するポート番号を受信し、かつ
前記サーバへのデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行するようにしたことを特徴とする端末装置の通信方法。
A first terminal under the first NAT router, a second terminal under the second NAT router, and a server not under the NAT router, wherein the first terminal and the second terminal have a source address, A communication method of a terminal device constituting the first terminal in a communication system that communicates with each other via the first NAT router and the second NAT router using a source port number, a destination address, and a destination port number,
Sending data to the server to notify the second terminal of the source port number;
Based on the received port number using a source port number that is different from the source port number used to transmit data to the server and that receives the port number related to the second terminal notified from the server A communication method for a terminal device, characterized in that a connection to the second terminal is attempted by transmitting data using a port number as a destination port number.
第1NATルータの配下にある第1端末と、第2NATルータの配下にある第2端末と、NATルータの配下にないサーバとから成り、前記第1端末及び前記第2端末が、送信元アドレス、送信元ポート番号、宛先アドレス及び宛先ポート番号を使って、前記第1NATルータ及び前記第2NATルータを介して互いに通信する通信システムにおける前記第1端末を構成する端末装置に適用されるコンピュータプログラムであって、
前記第2端末に送信元ポート番号を通知するために前記サーバにデータを送信する送信ステップと、
前記サーバから通知された前記第2端末に関するポート番号を受信するポート番号受信ステップと、
前記送信ステップによるデータの送信に使われた送信元ポート番号とは異なる送信元ポート番号を使い、前記ポート番号受信ステップにより受信したポート番号に基づくポート番号を宛先ポート番号としてデータを送信することにより前記第2端末への接続を試行する試行ステップとを有する備えたことを特徴とする端末装置に適用されるコンピュータプログラム。
A first terminal under the first NAT router, a second terminal under the second NAT router, and a server not under the NAT router, wherein the first terminal and the second terminal have a source address, A computer program applied to a terminal device constituting the first terminal in a communication system that communicates with each other via the first NAT router and the second NAT router using a source port number, a destination address, and a destination port number. And
A transmission step of transmitting data to the server to notify the second terminal of the transmission source port number;
A port number receiving step of receiving a port number related to the second terminal notified from the server;
By using a transmission source port number different from the transmission source port number used for data transmission in the transmission step, and transmitting data using the port number based on the port number received in the port number reception step as a destination port number A computer program applied to a terminal device, comprising: a trial step of trying to connect to the second terminal.
JP2013259476A 2013-12-16 2013-12-16 Communication system and terminal device Pending JP2015119217A (en)

Priority Applications (4)

Application Number Priority Date Filing Date Title
JP2013259476A JP2015119217A (en) 2013-12-16 2013-12-16 Communication system and terminal device
PCT/JP2014/079027 WO2015093158A1 (en) 2013-12-16 2014-10-31 Communication system, terminal apparatus, and server
US15/104,754 US9923866B2 (en) 2013-12-16 2014-10-31 Communication system, terminal apparatus and server
EP14872201.0A EP3086517A4 (en) 2013-12-16 2014-10-31 Communication system, terminal apparatus, and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2013259476A JP2015119217A (en) 2013-12-16 2013-12-16 Communication system and terminal device

Publications (1)

Publication Number Publication Date
JP2015119217A true JP2015119217A (en) 2015-06-25

Family

ID=53531617

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2013259476A Pending JP2015119217A (en) 2013-12-16 2013-12-16 Communication system and terminal device

Country Status (1)

Country Link
JP (1) JP2015119217A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004180003A (en) * 2002-11-27 2004-06-24 Kitt Peak:Kk Communication network system and communication connection method
JP2005117587A (en) * 2003-10-10 2005-04-28 Newrong Inc Communication method
JP2007181122A (en) * 2005-12-28 2007-07-12 Fractalist Inc Communication method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004180003A (en) * 2002-11-27 2004-06-24 Kitt Peak:Kk Communication network system and communication connection method
JP2005117587A (en) * 2003-10-10 2005-04-28 Newrong Inc Communication method
JP2007181122A (en) * 2005-12-28 2007-07-12 Fractalist Inc Communication method

Similar Documents

Publication Publication Date Title
KR101139675B1 (en) Traversal of symmetric network address translator for multiple simultaneous connections
EP2220852B1 (en) Communicating a selection of a potential configuration
US9143421B2 (en) Network system capable of implementing stun with the assistance of two network devices and method thereof
JP4961368B2 (en) Terminal device, NAT traversal method, and program
KR20100019420A (en) Peer-to-peer collaboration system with edge routing
JP2006229985A (en) Automatic discovery of pseudo-wire peer address in ethernet-based network
WO2013182163A1 (en) System and method for implementing multi-apn networking for terminal
CN108141409B (en) Communication system, address notification device, communication control device, terminal, communication method, and program
JP2011160103A (en) Gateway device and program, and communication system
JP4712481B2 (en) Communication method and apparatus
JP6387605B2 (en) Communication system and communication method
Vashishth et al. Addressing challenges in browser based P2P content sharing framework using WebRTC
JP6331421B2 (en) Communication system and server
WO2015093158A1 (en) Communication system, terminal apparatus, and server
Steinmetzer et al. TPy: A lightweight framework for agile distributed network experiments
JP2015119217A (en) Communication system and terminal device
WO2022201980A1 (en) Communication method, router, server, communication system, and communication program
JP5723808B2 (en) COMMUNICATION DEVICE, COMMUNICATION METHOD, AND PROGRAM
Comer et al. WIST: Wi-SUN FAN Protocol Emulation Testbed
JP2011019007A (en) Method, device, system and program for avoiding network address overlap
JP5084716B2 (en) VPN connection apparatus, DNS packet control method, and program
JP6413543B2 (en) Load balancing device, server, load balancing system, load balancing program
JP2010157857A (en) Vpn connection device, packet control method, and program
Nuño et al. Automatic deployment of a communication mesh for synchronous e-learning activities
JP2009135697A (en) Ip packet repeating method in communications network, and gateway device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20161020

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20171010

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20180403