JP2021052240A - Program, communication device, and communication method - Google Patents

Program, communication device, and communication method Download PDF

Info

Publication number
JP2021052240A
JP2021052240A JP2019172222A JP2019172222A JP2021052240A JP 2021052240 A JP2021052240 A JP 2021052240A JP 2019172222 A JP2019172222 A JP 2019172222A JP 2019172222 A JP2019172222 A JP 2019172222A JP 2021052240 A JP2021052240 A JP 2021052240A
Authority
JP
Japan
Prior art keywords
port number
router
port
user terminal
forwarding
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.)
Granted
Application number
JP2019172222A
Other languages
Japanese (ja)
Other versions
JP6671676B1 (en
Inventor
佐藤 元彦
Motohiko Sato
元彦 佐藤
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.)
Konami Digital Entertainment Co Ltd
Original Assignee
Konami Digital Entertainment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Konami Digital Entertainment Co Ltd filed Critical Konami Digital Entertainment Co Ltd
Priority to JP2019172222A priority Critical patent/JP6671676B1/en
Application granted granted Critical
Publication of JP6671676B1 publication Critical patent/JP6671676B1/en
Publication of JP2021052240A publication Critical patent/JP2021052240A/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

To appropriately set port forwarding by UPnP to normally communicate with other computers.SOLUTION: A program causes a computer to perform: a step (S108) of setting, in a router, port forwarding by UPnP corresponding to a second port number different from a first port number used by the router by a predetermined number; a step (S110) of using the set port forwarding to transmit a STUN packet to a server; a step (S112) of receiving the STUN packet from the server; and a step (S122) of using port forwarding by UPnP corresponding to the second port number to perform P2P communication with another user terminal when receiving the STUN packet.SELECTED DRAWING: Figure 6

Description

本発明は、プログラム、通信装置、および通信方法に関する。 The present invention relates to programs, communication devices, and communication methods.

特許文献1に、端末装置が他の通信相手とルータ装置越しにP2P(Pear to Pear)通信する際に、通信に用いるIPアドレスとポート番号を適切に処理する通信システム等の一例が開示される。この技術は、いわゆるUPnP(Universal Plug and Play)通信以外の技術によって、簡易にNAT(Network Address Translation)/NAPT(Network Address Port Translation)を超えるP2P通信を実行する。 Patent Document 1 discloses an example of a communication system or the like that appropriately processes an IP address and a port number used for communication when a terminal device performs P2P (Pear to Pear) communication with another communication partner via a router device. .. This technology easily executes P2P communication exceeding NAT (Network Address Translation) / NAPT (Network Address Port Translation) by a technology other than so-called UPnP (Universal Plug and Play) communication.

特開2007−266863号公報Japanese Unexamined Patent Publication No. 2007-266863

異なる端末間でのP2P通信には、UPnPによるポートフォワーディングを用いた通信が適している。しかし、近年、ルータに割り当てられるポートに制限が生じるようになったことから、固定値のポート番号を用いる従来の手法では、UPnPによるポートフォワーディングをルータに適切に設定できない場合が生じてきた。さらには、UPnPによるポートフォワーディングを前提としたP2P通信が正常に行えない場合も生じてきた。この問題は、P2P通信以外の通信でも生じ得る。 For P2P communication between different terminals, communication using port forwarding by UPnP is suitable. However, in recent years, since the ports assigned to routers have been restricted, there have been cases where port forwarding by UPnP cannot be appropriately set in routers by the conventional method using a fixed value port number. Furthermore, there have been cases where P2P communication premised on port forwarding by UPnP cannot be performed normally. This problem can occur in communications other than P2P communications.

本発明のいくつかの態様は、UPnPによるポートフォワーディングを適切に設定し、他のコンピュータと正常に通信するプログラム、通信装置、および通信方法を提供することを目的の一つとする。 One of the objects of the present invention is to provide a program, a communication device, and a communication method for appropriately setting port forwarding by UPnP and normally communicating with other computers.

上述した課題を解決するために、本発明の一態様は、通信システムを構成するコンピュータに、NAPT機能を有するルータを介して、第1信号をサーバに送信するステップと、前記第1信号に対する第1返答を、前記サーバから受信するステップと、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定するステップと、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定するステップと、前記ポートフォワーディングを用いて、第2信号を前記サーバに送信するステップと、前記第2信号に対する第2返答を、前記サーバから受信するステップと、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他のコンピュータと通信するステップとを実行させる、プログラムである。 In order to solve the above-mentioned problems, one aspect of the present invention includes a step of transmitting a first signal to a server via a router having a NAPT function to a computer constituting a communication system, and a first with respect to the first signal. A step of receiving one reply from the server, a step of specifying a first port number used by the router at the time of transmitting the first signal based on the received first reply, and the first port number. A step of setting port forwarding by UPnP corresponding to a predetermined number of different second port numbers to the router, a step of transmitting a second signal to the server using the port forwarding, and a second with respect to the second signal. A step of receiving a reply from the server, and a step of communicating with another computer constituting the communication system by using port forwarding by UPnP corresponding to the second port number when the second reply is received. It is a program that executes.

また、本発明の一態様は、通信システムを構成する通信装置であって、NAPT機能を有するルータを介して、第1信号をサーバに送信する第1送信部と、前記第1信号に対する第1返答を、前記サーバから受信する第1受信部と、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定する特定部と、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定する設定部と、前記ポートフォワーディングを用いて、第2信号を前記サーバに送信する第2送信部と、前記第2信号に対する第2返答を、前記サーバから受信する第2受信部と、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他の通信装置と通信する通信部とを備えている、通信装置である。 Further, one aspect of the present invention is a communication device constituting a communication system, that is, a first transmission unit that transmits a first signal to a server via a router having a NAPT function, and a first transmission unit for the first signal. A first receiving unit that receives a response from the server, a specific unit that specifies a first port number used by the router when transmitting the first signal based on the received first response, and the first unit. A setting unit that sets port forwarding by UPnP corresponding to a second port number different from the port number by a predetermined number in the router, a second transmission unit that transmits a second signal to the server using the port forwarding, and a second transmission unit. When the second receiving unit that receives the second response to the second signal from the server and the second response are received, the communication system is used by using port forwarding by UPnP corresponding to the second port number. A communication device including a communication unit that communicates with other constituent communication devices.

また、本発明の一態様は、通信システムを構成するコンピュータが実行する通信方法であって、NAPT機能を有するルータを介して、第1信号をサーバに送信するステップと、前記第1信号に対する第1返答を、前記サーバから受信するステップと、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定するステップと、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定するステップと、前記ポートフォワーディングを用いて、第2信号を前記サーバに送信するステップと、前記第2信号に対する第2返答を、前記サーバから受信するステップと、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他のコンピュータと通信するステップとを含む、通信方法である。 Further, one aspect of the present invention is a communication method executed by a computer constituting a communication system, in which a step of transmitting a first signal to a server via a router having a NAPT function and a first with respect to the first signal. A step of receiving one reply from the server, a step of specifying a first port number used by the router at the time of transmitting the first signal based on the received first reply, and the first port number. A step of setting port forwarding by UPnP corresponding to a predetermined number of different second port numbers to the router, a step of transmitting a second signal to the server using the port forwarding, and a second with respect to the second signal. A step of receiving a reply from the server, and a step of communicating with another computer constituting the communication system by using port forwarding by UPnP corresponding to the second port number when the second reply is received. It is a communication method including.

本発明の第1実施形態に係るゲームシステムの構成の一例を示すブロック図である。It is a block diagram which shows an example of the structure of the game system which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るユーザ端末のハードウェア構成の一例を示す図である。It is a figure which shows an example of the hardware composition of the user terminal which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るゲームサーバのハードウェア構成の一例を示す図である。It is a figure which shows an example of the hardware configuration of the game server which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るユーザ端末の機能構成の一例を示すブロック図である。It is a block diagram which shows an example of the functional structure of the user terminal which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るゲームサーバの機能構成の一例を示すブロック図である。It is a block diagram which shows an example of the functional structure of the game server which concerns on 1st Embodiment of this invention. 本発明の第1実施形態に係るユーザ端末が実行する通信方法の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the communication method executed by the user terminal which concerns on 1st Embodiment of this invention. 本実施形態に係るユーザ端末が実行する他の通信方法の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the other communication method executed by the user terminal which concerns on this Embodiment. 本発明の第2実施形態に係るゲームシステムAの構成の一例を示すブロック図である。It is a block diagram which shows an example of the structure of the game system A which concerns on 2nd Embodiment of this invention.

〔実施形態1〕
(ゲームシステム1の構成)
図1は、本実施形態に係るゲームシステム1の構成の一例を示すブロック図である。ゲームシステム1(通信システム)は、ユーザ端末10−1(コンピュータ、通信装置)、ユーザ端末10−2、ユーザ端末10−3(他のコンピュータ、他の通信装置)、ゲームサーバ30、ルータ50−1、ルータ50−2、およびSTUNサーバ70(サーバ)を備えている。これらの装置は、インターネットを含むネットワークNWを介して接続される。ユーザ端末10−1、ユーザ端末10−2、およびユーザ端末10−3は、同様の構成であるため、特に区別しない場合には、「−1」、「−2」等の記載を省略してユーザ端末10として説明する。ここでは3台のユーザ端末10を図示しているが、任意の台数のユーザ端末10がゲームサーバ30に接続されてもよい。ルータ50−1およびルータ50−2は、同様の構成であるため、特に区別しない場合には、「−1」、「−2」等の記載を省略してルータ50として説明する。ここでは2台のルータ50を図示しているが、任意の台数のルータ50がゲームサーバ30に接続されてもよい。
[Embodiment 1]
(Configuration of game system 1)
FIG. 1 is a block diagram showing an example of the configuration of the game system 1 according to the present embodiment. The game system 1 (communication system) includes a user terminal 10-1 (computer, communication device), a user terminal 10-2, a user terminal 10-3 (another computer, another communication device), a game server 30, and a router 50-. 1. A router 50-2 and a STUN server 70 (server) are provided. These devices are connected via a network NW including the Internet. Since the user terminal 10-1, the user terminal 10-2, and the user terminal 10-3 have the same configuration, the description of "-1", "-2", etc. is omitted unless otherwise specified. This will be described as the user terminal 10. Although three user terminals 10 are shown here, any number of user terminals 10 may be connected to the game server 30. Since the router 50-1 and the router 50-2 have the same configuration, unless otherwise specified, the description of "-1", "-2" and the like will be omitted and the router 50 will be described. Although two routers 50 are shown here, any number of routers 50 may be connected to the game server 30.

ユーザ端末10は、ユーザが利用するコンピュータである。ユーザ端末10の例として、PC(Personal Computer)、タブレットPC、スマートフォンおよびフィーチャーフォン等の携帯電話機、携帯情報端末(PDA:Personal Digital Assistant)、据え置き型ゲーム機、および携帯ゲーム機等が挙げられる。 The user terminal 10 is a computer used by the user. Examples of the user terminal 10 include a PC (Personal Computer), a tablet PC, a mobile phone such as a smartphone and a feature phone, a mobile information terminal (PDA: Personal Digital Assistant), a stationary game machine, a portable game machine, and the like.

ゲームサーバ30は、ユーザ端末10にゲームを提供するための、サーバ機能を有するコンピュータ(装置)である。ゲームサーバ30は、ユーザ端末10に、ゲームサーバ30と通信しながら進行するゲームを提供する。ゲームは、ユーザ端末10に予めインストールされたゲームであればよい。あるいは、ゲームは、ゲームを実行するための専用のプログラムをユーザ端末10にインストールすることが不要なブラウザゲームであってもよい。ブラウザゲームは、ユーザ端末10においてウェブブラウザを実行することによりウェブブラウザ上に表示されるゲーム画面でプレイすることが可能なゲームのことである。ゲームサーバ30は、ユーザ端末10に対するユーザの操作入力に基づいてゲームの各種の処理を実行し、ゲームの進行に応じてゲーム画面をユーザ端末10に表示させる。 The game server 30 is a computer (device) having a server function for providing a game to the user terminal 10. The game server 30 provides the user terminal 10 with a game that progresses while communicating with the game server 30. The game may be a game pre-installed on the user terminal 10. Alternatively, the game may be a browser game that does not require the user terminal 10 to install a dedicated program for executing the game. A browser game is a game that can be played on a game screen displayed on a web browser by executing a web browser on the user terminal 10. The game server 30 executes various processes of the game based on the user's operation input to the user terminal 10, and causes the user terminal 10 to display the game screen according to the progress of the game.

ルータ50は、ユーザ端末10と、ゲームサーバ30およびSTUNサーバとの通信を仲介するルーティング装置である。ルータ50は、NAPT(Network Address Port Translation)機能を有するルータである。図1では、ルータ50−1およびルータ50−2は、それぞれ別のユーザの自宅に設置される。また、ユーザ端末10−1および10−2がルータ50−1に接続され、ユーザ端末10−3がルータ50−3に接続される。 The router 50 is a routing device that mediates communication between the user terminal 10 and the game server 30 and the STUN server. The router 50 is a router having a NAPT (Network Address Port Translation) function. In FIG. 1, routers 50-1 and routers 50-2 are installed at different users' homes. Further, the user terminals 10-1 and 10-2 are connected to the router 50-1, and the user terminals 10-3 are connected to the router 50-3.

STUNサーバ70は、STUN(Session Traversal Utilities for NAT)のプロトコルに対応した、サーバ機能を有するコンピュータ(装置)である。STUNサーバ70は、当該プロトコルに基づいて、ネットワークNWを介して受信したSTUNパケットの送信元アドレスおよび送信元ポート番号を記憶する。STUNサーバ70は、さらに、受信したSTUNパケットの送信元に対して、記憶した送信元アドレスおよび送信元ポート番号を含むSTUNパケットを返送する。 The STUN server 70 is a computer (device) having a server function that supports the STUN (Session Traversal Utilities for NAT) protocol. The STUN server 70 stores the source address and source port number of the STUN packet received via the network NW based on the protocol. The STUN server 70 further returns a STUN packet including a stored source address and source port number to the source of the received STUN packet.

(ユーザ端末10のハード構成)
図2は、本実施形態に係るユーザ端末10のハードウェア構成の一例を示す図である。ユーザ端末10は、例えば、CPU(Central Processing Unit)11、通信部12、入力部13、表示部14、および記憶部15を備え、ネットワークNWを介して接続されたゲームサーバ30および他の装置等と通信部12を介して通信する。これらの構成要素は、バス16を介して相互に通信可能に接続されている。CPU11は、記憶部15に記憶された各種プログラムを実行し、ユーザ端末10の各部を制御する。
(Hardware configuration of user terminal 10)
FIG. 2 is a diagram showing an example of the hardware configuration of the user terminal 10 according to the present embodiment. The user terminal 10 includes, for example, a CPU (Central Processing Unit) 11, a communication unit 12, an input unit 13, a display unit 14, and a storage unit 15, and is a game server 30 and other devices connected via a network NW. Communicate with the communication unit 12 via the communication unit 12. These components are communicably connected to each other via the bus 16. The CPU 11 executes various programs stored in the storage unit 15 and controls each unit of the user terminal 10.

通信部12は、例えば、イーサネット(登録商標)ポートやUSB等のデジタル入出力ポート、WiFi(登録商標)等の無線通信等を含んで構成される。入力部13は、例えば、タッチパネルとしてディスプレイと一体に構成されており、ユーザの操作により各種の指示が入力される。また、入力部13は、キーボードやマウス、タッチパッドや、音声により各種の指示が入力されるマイクロホンなど、その他の入力装置であってもよい。 The communication unit 12 includes, for example, an Ethernet (registered trademark) port, a digital input / output port such as USB, and wireless communication such as WiFi (registered trademark). The input unit 13 is configured integrally with the display as a touch panel, for example, and various instructions are input by the user's operation. Further, the input unit 13 may be another input device such as a keyboard, a mouse, a touch pad, or a microphone into which various instructions are input by voice.

表示部14は、画像やテキスト等の情報を表示するディスプレイであり、例えば、液晶ディスプレイパネルまたは有機EL(Electro Luminescence)ディスプレイパネルなどを含んで構成される。 The display unit 14 is a display for displaying information such as an image or text, and includes, for example, a liquid crystal display panel or an organic EL (Electro Luminescence) display panel.

記憶部15は、例えば、HDD(Hard Disk Drive)、SSD(Solid State Drive)、EEPROM(Electrically Erasable Programmable Read-Only Memory)、ROM(Read Only Memory)、およびRAM(Random Access Memory)などを含み、ユーザ端末10が処理する各種情報および画像、ならびにプログラム(ゲーム制御プログラムを含む)等を記憶する。なお、記憶部15は、ユーザ端末10に内蔵されるものに限らず、USB等のデジタル入出力ポート等によって接続された外付け型の記憶装置でもよい。また、ユーザ端末10は、不図示のスピーカ、音声出力端子、カメラ、ジャイロセンサ、GPS(Global Positioning System)受信モジュールなどのハードウェア構成を含んで構成されてもよい。 The storage unit 15 includes, for example, an HDD (Hard Disk Drive), an SSD (Solid State Drive), an EEPROM (Electrically Erasable Programmable Read-Only Memory), a ROM (Read Only Memory), a RAM (Random Access Memory), and the like. It stores various information and images processed by the user terminal 10, programs (including a game control program), and the like. The storage unit 15 is not limited to the one built in the user terminal 10, and may be an external storage device connected by a digital input / output port such as USB. Further, the user terminal 10 may be configured to include a hardware configuration such as a speaker (not shown), an audio output terminal, a camera, a gyro sensor, and a GPS (Global Positioning System) receiving module.

(ゲームサーバ30のハードウェア構成)
図3は、本実施形態に係るゲームサーバ30のハードウェア構成の一例を示す図である。ゲームサーバ30は、例えば、CPU31、通信部32、入力部33、および記憶部34を備え、ネットワークNWを介して接続された複数のユーザ端末10および他の装置等と通信部32を介して通信する。これらの構成要素は、バス35を介して相互に通信可能に接続されている。CPU31は、記憶部34に記憶されたゲーム制御プログラムを実行し、複数のユーザ端末10でプレイ可能なゲームを提供する。
(Hardware configuration of game server 30)
FIG. 3 is a diagram showing an example of the hardware configuration of the game server 30 according to the present embodiment. The game server 30 includes, for example, a CPU 31, a communication unit 32, an input unit 33, and a storage unit 34, and communicates with a plurality of user terminals 10 and other devices connected via a network NW via the communication unit 32. To do. These components are communicably connected to each other via the bus 35. The CPU 31 executes a game control program stored in the storage unit 34 to provide a game that can be played by a plurality of user terminals 10.

通信部32は、例えば、イーサネット(登録商標)ポートやUSB等のデジタル入出力ポート、WiFi(登録商標)等の無線通信等を含んで構成され、CPU31による制御に基づいて、ネットワークNWを介して複数のユーザ端末10や他の装置と通信を行う。 The communication unit 32 includes, for example, an Ethernet (registered trademark) port, a digital input / output port such as USB, wireless communication such as WiFi (registered trademark), and the like, and is controlled by the CPU 31 via a network NW. Communicates with a plurality of user terminals 10 and other devices.

入力部33は、例えば、キーボードやマウス、タッチパッドや、音声により各種の指示が入力されるマイクロホンなど、その他の入力装置である。 The input unit 33 is another input device such as a keyboard, a mouse, a touch pad, or a microphone into which various instructions are input by voice.

記憶部34は、例えば、HDD、EEPROM、RAMなどを含み、ゲーム制御プログラム、アプリケーションプログラム、ゲームに必要な各種設定情報および履歴情報などを記憶する。なお、記憶部34は、ゲームサーバ30に内蔵されるものに限らず、USB等のデジタル入出力ポート等によって接続された外付け型の記憶装置でもよい。また、記憶部34は、ゲームサーバ30とは物理的に離れた外部の記憶装置であってもよく、ゲームサーバ30とインターネットなどの通信網を介して接続されてもよい。また、ゲームサーバ30は、不図示の表示部、スピーカ、音声出力端子などのハードウェア構成を含んで構成されてもよい。 The storage unit 34 includes, for example, an HDD, EEPROM, RAM, etc., and stores a game control program, an application program, various setting information necessary for the game, history information, and the like. The storage unit 34 is not limited to the one built in the game server 30, and may be an external storage device connected by a digital input / output port such as USB. Further, the storage unit 34 may be an external storage device physically separated from the game server 30, or may be connected to the game server 30 via a communication network such as the Internet. Further, the game server 30 may be configured to include a hardware configuration such as a display unit (not shown), a speaker, and an audio output terminal.

(ユーザ端末10の機能構成)
図4は、本実施形態に係るユーザ端末10の機能構成の一例を示すブロック図である。図4に示すように、ユーザ端末10は、記憶部15に記憶されているゲーム制御プログラムをCPU11が実行することにより実現される機能構成として、入力受付部110、表示制御部120、ゲーム管理部130、および通信制御部140(通信部、第1受信部、第2受信部、第1送信部、第2送信部)を備えている。通信制御部140は、ポート番号決定部141(特定部)およびポートフォワーディング設定部142(設定部)を備えている。
(Functional configuration of user terminal 10)
FIG. 4 is a block diagram showing an example of the functional configuration of the user terminal 10 according to the present embodiment. As shown in FIG. 4, the user terminal 10 has an input reception unit 110, a display control unit 120, and a game management unit as functional configurations realized by the CPU 11 executing a game control program stored in the storage unit 15. It includes 130 and a communication control unit 140 (communication unit, first receiving unit, second receiving unit, first transmitting unit, second transmitting unit). The communication control unit 140 includes a port number determination unit 141 (specific unit) and a port forwarding setting unit 142 (setting unit).

入力受付部110は、入力部13に対するユーザの操作を受け付ける。例えば、入力受付部110は、表示部14に表示されるゲーム画面に対してプレイするユーザの操作を、入力部13を介して受け付ける。また、入力受付部110は、受け付けたユーザの操作に基づく操作情報を、通信部12を介してゲームサーバ30へ送信する。操作情報には、コントローラなどの入力部3から出力された信号そのもの(例えば、所定のボタンが押下されたことを示す情報)が含まれる。操作情報には、他にも、入力部3から出力された信号そのものから、ゲームの状況に応じて加工された、ゲーム内で用いられる情報が含まれる。このような情報として、例えば、例えば所定のボタンの押下がキャラクタに所定の動作を実行させることを規定した情報が挙げられる。 The input receiving unit 110 receives a user's operation on the input unit 13. For example, the input receiving unit 110 receives the operation of the user who plays the game screen displayed on the display unit 14 via the input unit 13. Further, the input receiving unit 110 transmits the operation information based on the operation of the received user to the game server 30 via the communication unit 12. The operation information includes the signal itself (for example, information indicating that a predetermined button has been pressed) output from the input unit 3 of the controller or the like. The operation information also includes information used in the game, which is processed according to the situation of the game from the signal itself output from the input unit 3. Examples of such information include information that defines that pressing a predetermined button causes the character to perform a predetermined operation.

表示制御部120は、ゲーム管理部130が生成した各種のゲーム画像を表示部14に表示させる。 The display control unit 120 causes the display unit 14 to display various game images generated by the game management unit 130.

ゲーム管理部130は、ユーザ端末10において実行されるゲームに関する処理を管理する。 The game management unit 130 manages processing related to the game executed on the user terminal 10.

通信制御部140は、ユーザ端末10とゲームサーバ30との間の通信を制御する。通信制御部140は、例えば、入力受付部110が受け付けた操作に基づく操作情報を、通信部12を介してゲームサーバ30へ送信する。入力受付部110は、他にも、ゲームをプレイするユーザのユーザ情報、および、ゲーム処理の実行結果を示す情報なども、通信部12を介してゲームサーバ30へ送信する。ユーザ情報として、ユーザを識別するための識別情報(例えば、ユーザID)、パスワード、およびユーザ名(ゲーム内でのユーザの名称)等が挙げられる。また、通信制御部140は、ユーザ端末10でプレイされるゲームに関する情報を、通信部12を介してゲームサーバ30から取得する。通信制御部140は、さらに、ユーザ端末10とSTUNサーバ70との間の通信を制御する。 The communication control unit 140 controls communication between the user terminal 10 and the game server 30. The communication control unit 140 transmits, for example, operation information based on the operation received by the input reception unit 110 to the game server 30 via the communication unit 12. The input reception unit 110 also transmits user information of the user who plays the game, information indicating the execution result of the game process, and the like to the game server 30 via the communication unit 12. Examples of the user information include identification information for identifying the user (for example, user ID), password, user name (name of the user in the game), and the like. Further, the communication control unit 140 acquires information about the game played on the user terminal 10 from the game server 30 via the communication unit 12. The communication control unit 140 further controls communication between the user terminal 10 and the STUN server 70.

ポート番号決定部141は、ユーザ端末10のローカルポート番号、およびルータ50のポート番号をそれぞれ決定する。ポートフォワーディング設定部142は、NAPTに基づくポートフォワーディングを、ルータ50に設定する。ポートフォワーディングの詳細は後述する。 The port number determination unit 141 determines the local port number of the user terminal 10 and the port number of the router 50, respectively. The port forwarding setting unit 142 sets the port forwarding based on NAPT in the router 50. Details of port forwarding will be described later.

(ゲームサーバ30の機能構成)
図5は、本実施形態に係るゲームサーバ30の機能構成の一例を示すブロック図である。図5に示すように、ゲームサーバ30は、記憶部34に記憶されているゲーム制御プログラムをCPU31が実行することにより実現される機能構成として、ゲーム管理部310、マッチング部320、および通信制御部330を備えている。
(Functional configuration of game server 30)
FIG. 5 is a block diagram showing an example of the functional configuration of the game server 30 according to the present embodiment. As shown in FIG. 5, the game server 30 has a game management unit 310, a matching unit 320, and a communication control unit as functional configurations realized by the CPU 31 executing a game control program stored in the storage unit 34. It is equipped with 330.

ゲーム管理部310は、ゲームサーバ30において実行されるゲームに関する処理を管理する。マッチング部320は、複数のユーザのなから、対戦ゲームにおける対戦相手である2名のユーザをマッチングする。通信制御部330は、ゲームサーバ30とユーザ端末10との間の通信を制御する。通信制御部330は、例えば、ユーザ端末10から送信された操作情報を、通信部32を介して受信する。通信制御部330は、さらに、受信した操作情報に基づいてゲーム処理した結果を示す、ゲームの状況情報を、通信部32を介してユーザ端末10に送信する。状況情報として、例えば、ゲームがサッカーゲームである場合、得点情報、および選手の現在位置情報などが挙げられる。 The game management unit 310 manages processing related to the game executed on the game server 30. The matching unit 320 matches two users who are opponents in a battle game from among a plurality of users. The communication control unit 330 controls communication between the game server 30 and the user terminal 10. The communication control unit 330 receives, for example, the operation information transmitted from the user terminal 10 via the communication unit 32. The communication control unit 330 further transmits the game status information indicating the result of the game processing based on the received operation information to the user terminal 10 via the communication unit 32. Examples of the situation information include, when the game is a soccer game, score information, player's current position information, and the like.

(ネットワーク接続形態の詳細)
本実施形態では、ゲームサーバ30、ルータ50、およびSTUNサーバ70には、ネットワークNWにおいて一意に識別されるグローバルIPアドレスがそれぞれ割り当てられている。本実施形態では、ゲームサーバ30にIPアドレス「11.11.11.1」が割り当てられ、STUNサーバ70にIPアドレス「11.11.11.2」が割り当てられる。ゲームサーバ30は、例えばポート番号「1000」を使ってゲームサーバ30上でプロセスとして実行されるゲームサービスを、各ユーザ端末10に提供する。STUNサーバ70は、例えばポート番号「80」を使ってSTUNサーバ70上でプロセスとして実行されるSTUNサービスを、各ユーザ端末10に提供する。本実施形態では、さらに、ルータ50−1にIPアドレス「22.22.22.1」が割り当てられ、ルータ50−2にIPアドレス「22.22.22.2」が割り当てられる。
(Details of network connection form)
In the present embodiment, the game server 30, the router 50, and the STUN server 70 are each assigned a global IP address that is uniquely identified in the network NW. In the present embodiment, the game server 30 is assigned the IP address "11.11.1.1", and the STUN server 70 is assigned the IP address "11.11.1.2". The game server 30 provides each user terminal 10 with a game service executed as a process on the game server 30, for example, using the port number “1000”. The STUN server 70 provides each user terminal 10 with a STUN service that is executed as a process on the STUN server 70 using, for example, the port number “80”. In the present embodiment, the router 50-1 is further assigned the IP address "22.22.22.1", and the router 50-2 is further assigned the IP address "22.22.22.2".

ユーザ端末10は、これらのグローバルIPアドレスを必要に応じて参照することができる。本実施形態では、ユーザ端末10−1および10−2は、ゲームサーバ30、ルータ50−1、およびSTUNサーバ70の各IPアドレスを、事前に参照済みである。また、ユーザ端末10−3は、ゲームサーバ30、ルータ50−2、およびSTUNサーバ70の各IPアドレスを、事前に参照済みである。 The user terminal 10 can refer to these global IP addresses as needed. In the present embodiment, the user terminals 10-1 and 10-2 have already referred to the IP addresses of the game server 30, the router 50-1, and the STUN server 70 in advance. Further, the user terminals 10-3 have already referred to the IP addresses of the game server 30, the router 50-2, and the STUN server 70 in advance.

ユーザ端末10には、ユーザ端末10が接続されるプライベートネットワークにおいて一意に識別されるプライベートIPアドレスが割り当てられる。図1では、ユーザ端末10−1にIPアドレス「192.168.10.1」が割り当てられ、ユーザ端末10−2にIPアドレス「192.168.10.2」が割り当てられる。ユーザ端末10−3にIPアドレス「192.168.10.1」が割り当てられる。これらのIPアドレスはプライベートネットワークの内側においてのみ有効なアドレスであるため、プライベートネットワークの外側に配置されるゲームサーバ30およびSTUNサーバ70が参照することはできない。 The user terminal 10 is assigned a private IP address that is uniquely identified in the private network to which the user terminal 10 is connected. In FIG. 1, the IP address “192.168.10.1” is assigned to the user terminal 10-1, and the IP address “192.168.10.2” is assigned to the user terminal 10-2. The IP address "192.168.10.1" is assigned to the user terminal 10-3. Since these IP addresses are valid only inside the private network, they cannot be referred to by the game server 30 and the STUN server 70 located outside the private network.

以下では、ユーザ端末10−1を操作するユーザと、ユーザ端末10−3を操作する他のユーザとがオンラインゲームで対戦する際の、ユーザ端末10−1とユーザ端末10−3と間で行われるP2P通信について説明する。 In the following, a line is performed between the user terminal 10-1 and the user terminal 10-3 when the user who operates the user terminal 10-1 and another user who operates the user terminal 10-3 compete in an online game. The P2P communication to be described will be described.

(通信方法の詳細)
図6は、本実施形態に係るユーザ端末10が実行する通信方法の処理手順を示すフローチャートである。図6に示す一連の処理が開始される前に、ユーザ端末10−1のユーザは、ゲームのオンライン対戦をプレイするための操作をユーザ端末10−1に入力する。入力受付部110は、この入力を受け付けると、P2P通信のための準備処理の実行を通信制御部140に指示する。通信制御部140は、この指示に基づいて、ルータ50−1を介して、STUNパケット(第1信号)を、STUNサーバ70に送信する(S101)。その際、通信制御部140は、STUNパケットを、ルータ50−1によって設定されるポートフォワーディングを用いて送信する。
(Details of communication method)
FIG. 6 is a flowchart showing a processing procedure of a communication method executed by the user terminal 10 according to the present embodiment. Before the series of processes shown in FIG. 6 is started, the user of the user terminal 10-1 inputs an operation for playing the online match of the game to the user terminal 10-1. Upon receiving this input, the input receiving unit 110 instructs the communication control unit 140 to execute the preparatory process for P2P communication. Based on this instruction, the communication control unit 140 transmits a STUN packet (first signal) to the STUN server 70 via the router 50-1 (S101). At that time, the communication control unit 140 transmits the STUN packet using the port forwarding set by the router 50-1.

STUNパケット送信は、次のようにして実現される。まず、ポート番号決定部141が、ユーザ端末10−1のポート番号を決定する。このポート番号は、ユーザ端末10−1がルータ50−1と通信するために用いるローカルポート番号である。図6では、ポート番号決定部141は、固定のポート番号「5000」を決定する。通信制御部140は、決定されたポート番号「5000」を用いてSTUNパケットをルータ50−1に送信することによって、ルータ50−1を介してSTUNパケットをSTUNサーバ70に送信するようにルータ50−1に要求する。 STUN packet transmission is realized as follows. First, the port number determination unit 141 determines the port number of the user terminal 10-1. This port number is a local port number used by the user terminal 10-1 to communicate with the router 50-1. In FIG. 6, the port number determination unit 141 determines a fixed port number “5000”. The communication control unit 140 transmits the STUN packet to the router 50-1 using the determined port number “5000”, so that the STUN packet is transmitted to the STUN server 70 via the router 50-1. Request -1.

ルータ50−1は、ユーザ端末10−1からSTUNパケットを受信すると、NAPTに基づくポートフォワーディングをルータ50−1に設定する。ここでは、ルータ50−1は、UPnPによって設定されないポートフォワーディングを、第1セッションとしてルータ50−1に自動的に設定する。ここでいう「自動的に設定」とは、ルータ50−1がユーザ端末10−1からの指示を受けることなく、自らルータ50−1にポートフォワーディングを設定することを意味する。詳細には、ルータ50−1は、まず、ルータ50−1のポート番号「2000」(第1ポート番号)を決定する。このポート番号は、ルータ50−1がSTUNサーバ70などの外部装置とネットワークNWを介して通信するために用いるグローバルポート番号である。ここでは、ルータ50−1は、ルータ50−1が利用可能な空きポート番号のうちのポート番号「2000」を、STUNパケット送信用のポート番号として決定する。 When the router 50-1 receives the STUN packet from the user terminal 10-1, the router 50-1 sets the port forwarding based on the NAT to the router 50-1. Here, the router 50-1 automatically sets the port forwarding that is not set by UPnP to the router 50-1 as the first session. The term "automatically set" as used herein means that the router 50-1 sets port forwarding to the router 50-1 by itself without receiving an instruction from the user terminal 10-1. Specifically, the router 50-1 first determines the port number "2000" (first port number) of the router 50-1. This port number is a global port number used by the router 50-1 to communicate with an external device such as the STUN server 70 via the network NW. Here, the router 50-1 determines the port number "2000" among the free port numbers available to the router 50-1 as the port number for transmitting the STUN packet.

次に、ルータ50−1は、ユーザ端末10−1から受信したSTUNパケットの送信元アドレスおよび送信元ポート番号を、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「5000」から、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2000」に変換するように設定する。ルータ50−1は、変換後のSTUNパケットを、パケットの送信先(STUNサーバ70)に転送する。 Next, the router 50-1 sets the source address and source port number of the STUN packet received from the user terminal 10-1 to the IP address "192.168.10.1" and the port number of the user terminal 10-1. It is set to translate from "5000" to the IP address "22.22.22.1" and the port number "2000" of the router 50-1. The router 50-1 forwards the converted STUN packet to the packet transmission destination (STUN server 70).

ルータ50−1はさらに、ルータ50−1のポート番号「2000」宛に届いたSTUNパケットの送信先アドレスおよびポート番号を、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2000」から、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「5000」に変換するように設定する。これにより、ルータ50−1は、変換後のSTUNパケットを、パケットの送信先(ユーザ端末10−1)に転送する。 The router 50-1 further sets the destination address and port number of the STUN packet that arrived at the port number "2000" of the router 50-1 to the IP address "22.22.22.1" of the router 50-1 and the port. The number "2000" is set to be converted to the IP address "192.168.10.1" and the port number "5000" of the user terminal 10-1. As a result, the router 50-1 forwards the converted STUN packet to the packet destination (user terminal 10-1).

言い換えれば、ルータ50−1は、ユーザ端末10−1がポート番号「5000」を用いてSTUNサーバ70に送信しようとしたSTUNパケットを、ルータ50−1がポート番号「2000」を用いてSTUNサーバ70に送信したSTUNパケットとしてSTUNサーバ70に転送するように設定する。さらに、ルータ50−1のポート番号「2000」宛に届いたSTUNパケットを、ポート番号「5000」を用いるユーザ端末10−1に転送するように設定する。 In other words, the router 50-1 sends the STUN packet that the user terminal 10-1 tries to send to the STUN server 70 using the port number "5000", and the router 50-1 uses the port number "2000" to send the STUN server to the STUN server. It is set to be forwarded to the STUN server 70 as a STUN packet transmitted to the 70. Further, the STUN packet that arrives at the port number "2000" of the router 50-1 is set to be forwarded to the user terminal 10-1 that uses the port number "5000".

ルータ50−1は、第1セッションとして設定されるポートフォワーディングを用いて、ルータ50−1から送信要求されたSTUNパケットを、STUNサーバ70に転送する。これにより、これにより、通信制御部140は、ルータ50−1を介してSTUNパケットをSTUNサーバ70に送信することができる。また、STUNサーバ70は、送信元アドレスとしてIPアドレス「22.22.22.1」およびポート番号「2000」を含むSTUNパケットをルータ50−1から受信する。STUNサーバ70は、受信したSTUNパケットに含まれるIPアドレス「22.22.22.1」およびポート番号「2000」を記憶する。STUNサーバ70は、さらに、記憶したIPアドレス「22.22.22.1」およびポート番号「2000」を含むSTUNパケット(第1返答)を、ルータ50−1のポート番号「2000」宛に送信する。 The router 50-1 forwards the STUN packet requested to be transmitted from the router 50-1 to the STUN server 70 by using the port forwarding set as the first session. As a result, the communication control unit 140 can transmit the STUN packet to the STUN server 70 via the router 50-1. Further, the STUN server 70 receives the STUN packet including the IP address "22.22.22.1" and the port number "2000" as the source address from the router 50-1. The STUN server 70 stores the IP address "22.22.22.1" and the port number "2000" included in the received STUN packet. The STUN server 70 further transmits a STUN packet (first reply) including the stored IP address "22.22.22.1" and the port number "2000" to the port number "2000" of the router 50-1. To do.

通信制御部140は、STUNサーバ70から送信されたSTUNパケットを受信する(S102)。詳細には、STUNサーバ70から送信されたSTUNパケットは、ルータ50−1のポート番号「2000」宛に届く。ルータ50−1は、第1セッションとして設定されたポートフォワーディングを用いて、STUNサーバ70から受信したSTUNパケットを、ユーザ端末10−1のポート番号「5000」に転送する。これにより、通信制御部140は、ルータ50−1を介してSTUNパケットをSTUNサーバ70から受信することができる。 The communication control unit 140 receives the STUN packet transmitted from the STUN server 70 (S102). Specifically, the STUN packet transmitted from the STUN server 70 arrives at the port number "2000" of the router 50-1. The router 50-1 forwards the STUN packet received from the STUN server 70 to the port number "5000" of the user terminal 10-1 by using the port forwarding set as the first session. As a result, the communication control unit 140 can receive the STUN packet from the STUN server 70 via the router 50-1.

ポート番号決定部141は、受信したSTUNパケットに含まれるルータ50−1のポート番号「2000」を、STUNパケットから特定する(S104)。これにより、通信制御部140は、ルータ50−1がポート番号「2000」を使用可能であることを把握することができる。 The port number determination unit 141 identifies the port number “2000” of the router 50-1 included in the received STUN packet from the STUN packet (S104). As a result, the communication control unit 140 can grasp that the router 50-1 can use the port number "2000".

以上の処理と並行して、ルータ50−1に接続されるユーザ端末10−2が、シングルプレイゲームを開始するための開始要求を、ゲームサーバ30に対して送信する。その際、ユーザ端末10−2は、固定のポート番号「6000」を用いて、開始要求をルータ50−1に送信することによって、ルータ50−1を介して開始要求をゲームサーバ30に送信するようにルータ50−1に要求する。 In parallel with the above processing, the user terminal 10-2 connected to the router 50-1 transmits a start request for starting the single play game to the game server 30. At that time, the user terminal 10-2 transmits the start request to the game server 30 via the router 50-1 by transmitting the start request to the router 50-1 using the fixed port number “6000”. Request router 50-1 to do so.

ルータ50−1は、ユーザ端末10−2から開始要求を受信すると、NAPTに基づくポートフォワーディングをルータ50−1に設定する。ここでは、ルータ50−1は、UPnPによって設定されないポートフォワーディングを、第2セッションとしてルータ50−1に自動的に設定する。詳細には、ルータ50−1は、まず、ルータ50−1のポート番号「2020」を決定する。このポート番号は、ルータ50−1がゲームサーバ30などの外部装置とネットワークNWを介して通信するために用いるグローバルポート番号である。ここでは、ルータ50−1は、ルータ50−1が利用可能な空きポート番号のうちのポート番号「2020」を、開始要求送信用のポート番号として決定する。第2セッションは、第1セッションとは独立して、ルータ50−1が自動的にルータ50−1に設定するものである。 When the router 50-1 receives the start request from the user terminal 10-2, the router 50-1 sets the port forwarding based on the NAT to the router 50-1. Here, the router 50-1 automatically sets the port forwarding that is not set by UPnP to the router 50-1 as the second session. Specifically, the router 50-1 first determines the port number "2020" of the router 50-1. This port number is a global port number used by the router 50-1 to communicate with an external device such as the game server 30 via the network NW. Here, the router 50-1 determines the port number "2020" among the free port numbers available to the router 50-1 as the port number for transmitting the start request. In the second session, the router 50-1 automatically sets the router 50-1 independently of the first session.

次に、ルータ50−1は、ユーザ端末10−2から受信した開始要求の送信元アドレスおよび送信元ポート番号を、ユーザ端末10−2のIPアドレス「192.168.10.2」およびポート番号「6000」から、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2020」に変換するように設定する。ルータ50−1は、変換後の開始要求を、開始要求の送信先であるゲームサーバ30に転送する。 Next, the router 50-1 sets the source address and source port number of the start request received from the user terminal 10-2 to the IP address "192.168.10.2" and the port number of the user terminal 10-2. It is set to translate from "6000" to the IP address "22.22.22.1" and the port number "2020" of the router 50-1. The router 50-1 transfers the converted start request to the game server 30 which is the transmission destination of the start request.

ルータ50−1はさらに、ルータ50−1のポート番号「2020」宛に届いたゲームサーバ30からパケットの送信先アドレスおよびポート番号を、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2020」から、ユーザ端末10−2のIPアドレス「192.168.10.2」およびポート番号「6000」に変換するように設定する。これにより、ルータ50−1は、変換後のパケットを、パケットの送信先であるユーザ端末10−2に転送する。 Router 50-1 further sets the destination address and port number of the packet from the game server 30 that arrived at the port number "2020" of router 50-1 to the IP address "22.22.22.1" of router 50-1. And the port number "2020" are set to be converted into the IP address "192.168.10.2" and the port number "6000" of the user terminal 10-2. As a result, the router 50-1 forwards the converted packet to the user terminal 10-2, which is the transmission destination of the packet.

以上のように、ルータ50−1は、ルータ50−1宛に届いたパケットを、ルータ50−1に設定した各セッションに基づいて、ユーザ端末10−1およびユーザ端末10−2のうちいずれか振り分けて転送する。すなわち、ルータ50−1のポート番号「2000」宛に届いたパケットは、ポート番号「2000」に対応する第1セッションに基づいてユーザ端末10−1に転送し、ルータ50−1のポート番号「2020」宛に届いたパケットは、ポート番号「2020」に対応する第2セッションに基づいてユーザ端末10−2に転送する。このようにして、ルータ50−1は、ユーザ端末10−1またはユーザ端末10−2宛のパケットを、正しい送信先に転送することができる。 As described above, the router 50-1 sends the packet delivered to the router 50-1 to either the user terminal 10-1 or the user terminal 10-2 based on each session set in the router 50-1. Sort and transfer. That is, the packet arriving at the port number "2000" of the router 50-1 is forwarded to the user terminal 10-1 based on the first session corresponding to the port number "2000", and the port number "2000" of the router 50-1 ". The packet arriving at "2020" is forwarded to the user terminal 10-2 based on the second session corresponding to the port number "2020". In this way, the router 50-1 can forward the packet addressed to the user terminal 10-1 or the user terminal 10-2 to the correct destination.

ユーザ端末10−1およびユーザ端末10−2は、通常、ルータ50−1が自動的にセッションを設定することを把握することはない。ユーザ端末10−1またはユーザ端末10−2がパケットの送信をルータ50−1に要求すれば、ルータ50−1は、自動的にセッションを設定することによって、この送信要求に対応する。また、ルータ50−1に自動的に設定された第1セッションおよび第2セッションには有効期限があるため、第1セッションおよび第2セッションは、設定後に所定時間が過ぎると消滅する。これにより、第1セッションおよび第2セッションの設定時に用いた各ポート番号が開放される。したがって、ルータ50−1は、開放されたポート番号を他の通信に用いることができるので、少ないポート番号を有効活用することができる。 User terminal 10-1 and user terminal 10-2 usually do not know that router 50-1 automatically sets up a session. If the user terminal 10-1 or the user terminal 10-2 requests the router 50-1 to send a packet, the router 50-1 responds to this transmission request by automatically setting a session. Further, since the first session and the second session automatically set in the router 50-1 have an expiration date, the first session and the second session disappear after a predetermined time has passed after the setting. As a result, each port number used when setting the first session and the second session is released. Therefore, since the router 50-1 can use the open port number for other communication, it is possible to effectively utilize the small port number.

本実施形態では、ユーザ端末10−1は、第1セッションおよび第2セッションが自動的に設定された後、ユーザ端末10−3とP2P通信するための第3セッションをルータ50−1に設定する。まず、ポート番号決定部141は、STUNパケットから特定したポート番号「2000」と所定数異なるポート番号を決定する。ここでは、所定数は1である。したがって、ポート番号決定部141は、ポート番号「2000」よりも1つ大きいルータ50−1のポート番号「2001」(第2ポート番号)を特定する(S106)。 In the present embodiment, the user terminal 10-1 sets the router 50-1 as the third session for P2P communication with the user terminal 10-3 after the first session and the second session are automatically set. .. First, the port number determination unit 141 determines a port number different from the port number "2000" specified from the STUN packet by a predetermined number. Here, the predetermined number is 1. Therefore, the port number determination unit 141 identifies the port number “2001” (second port number) of the router 50-1, which is one larger than the port number “2000” (S106).

ポートフォワーディング設定部142は、特定されたポート番号「2001」に対応するUPnPによるポートフォワーディングを、第3セッションとしてルータ50−1に設定する(S108)。すなわち、ポートフォワーディング設定部142は、UPnPのプロトコルに従って、SOAPメッセージを介してポートフォワーディングをルータ50−1に設定する。この設定は、次のようにして実現される。まず、ポート番号決定部141は、ルータ50−1のポート番号「2001」に対応するルータ50−1の新たなローカルポート番号を決定する。ここでは、「5000」よりも1つ大きいポート番号「5001」を特定する。これにより、ルータ50−1は、ユーザ端末10−1のポート番号「5001」およびルータ50−1のポート番号「2001」に対応したポートフォワーディングを、ルータ50−1に設定する。 The port forwarding setting unit 142 sets the port forwarding by UPnP corresponding to the specified port number “2001” in the router 50-1 as the third session (S108). That is, the port forwarding setting unit 142 sets the port forwarding to the router 50-1 via the SOAP message according to the UPnP protocol. This setting is realized as follows. First, the port number determination unit 141 determines a new local port number of the router 50-1 corresponding to the port number "2001" of the router 50-1. Here, the port number "5001", which is one larger than "5000", is specified. As a result, the router 50-1 sets the port forwarding corresponding to the port number "5001" of the user terminal 10-1 and the port number "2001" of the router 50-1 to the router 50-1.

詳細には、ポートフォワーディング設定部142は、ユーザ端末10−1がポート番号「5001」を用いてルータ50−1に送信要求したSTUNパケットの送信元アドレスおよび送信元ポート番号を、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「5001」から、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2001」に変換するように、ルータ50−1に設定する。ポートフォワーディング設定部142は、さらに、ルータ50−1のポート番号「2001」宛に届いたSTUNパケットの送信先アドレスおよびポート番号を、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2001」から、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「5001」に変換するように、ルータ50−1に設定する。 Specifically, the port forwarding setting unit 142 sets the source address and source port number of the STUN packet requested by the user terminal 10-1 to the router 50-1 using the port number "5001" to be set to the user terminal 10-. The router so as to translate from the IP address "192.168.10.1" and the port number "5001" of 1 to the IP address "22.22.22.1" and the port number "2001" of the router 50-1. Set to 50-1. The port forwarding setting unit 142 further sets the destination address and port number of the STUN packet that arrived at the port number "2001" of the router 50-1 to the IP address "22.22.22.1" of the router 50-1. And the port number "2001" is set in the router 50-1 so as to be converted into the IP address "192.168.10.1" and the port number "5001" of the user terminal 10-1.

言い換えれば、ポートフォワーディング設定部142は、ユーザ端末10−1がポート番号「5001」を用いてSTUNサーバ70に送信しようとしたSTUNパケットを、ルータ50−1がポート番号「2001」を用いてSTUNサーバ70に送信したSTUNパケットとしてSTUNサーバ70に転送するように、ルータ50−1に設定する。さらに、ルータ50−1のポート番号「2001」宛に届いたSTUNパケットを、ポート番号「5001」を用いるユーザ端末10−1に転送するように、ルータ50−1に設定する。 In other words, the port forwarding setting unit 142 sends the STUN packet that the user terminal 10-1 tries to send to the STUN server 70 using the port number "5001", and the router 50-1 uses the port number "2001" to send the STUN packet. The router 50-1 is set to be forwarded to the STUN server 70 as a STUN packet transmitted to the server 70. Further, the router 50-1 is set to forward the STUN packet delivered to the port number "2001" of the router 50-1 to the user terminal 10-1 using the port number "5001".

通信制御部140は、第3セッションとしてルータ50−1に設定したポートフォワーディングを用いて、STUNパケット(第2信号)をSTUNサーバ70に送信する(S110)。ルータ50−1には第3セッションが設定済みであるため、ルータ50−1は、新たなセッションを設定することなく、ユーザ端末10−1から送信要求されたSTUNパケットを、ルータ50−1のポート番号「2001」から送信されたSTUNパケットとして、STUNサーバ70に転送する。これにより、通信制御部140は、第3セッションに対応するポートフォワーディングを用いて、STUNパケットをSTUNサーバ70に送信することができる。また、STUNサーバ70は、送信元アドレスとしてIPアドレス「22.22.22.1」およびポート番号「2001」を含むSTUNパケットから受信する。STUNサーバ70は、受信したSTUNパケットに含まれるIPアドレス「22.22.22.1」およびポート番号「2001」を記憶する。STUNサーバ70は、さらに、記憶したIPアドレス「22.22.22.1」およびポート番号「2001」を含むSTUNパケット(第2返答)を、ルータ50−1のポート番号「2001」宛に送信する。 The communication control unit 140 transmits a STUN packet (second signal) to the STUN server 70 by using the port forwarding set in the router 50-1 as the third session (S110). Since the third session has already been set for the router 50-1, the router 50-1 sends the STUN packet requested to be transmitted from the user terminal 10-1 to the router 50-1 without setting a new session. It is transferred to the STUN server 70 as a STUN packet transmitted from the port number "2001". As a result, the communication control unit 140 can transmit the STUN packet to the STUN server 70 by using the port forwarding corresponding to the third session. Further, the STUN server 70 receives from the STUN packet including the IP address "22.22.22.1" and the port number "2001" as the source address. The STUN server 70 stores the IP address "22.22.22.1" and the port number "2001" included in the received STUN packet. The STUN server 70 further transmits a STUN packet (second reply) including the stored IP address "22.22.22.1" and the port number "2001" to the port number "2001" of the router 50-1. To do.

通信制御部140は、STUNサーバ70から送信されたSTUNパケットを受信する(S112)。詳細には、STUNサーバ70から送信されたSTUNパケットは、ルータ50−1のポート番号「2001」宛に届く。ルータ50−1は、第3セッションとして設定されたポートフォワーディングを用いて、STUNサーバ70から受信したポート番号「2001」宛のSTUNパケットを、ユーザ端末10−1のポート番号「5001」に転送する。これにより、通信制御部140は、ルータ50−1を介してSTUNパケットをSTUNサーバ70から受信することができる。 The communication control unit 140 receives the STUN packet transmitted from the STUN server 70 (S112). Specifically, the STUN packet transmitted from the STUN server 70 arrives at the port number "2001" of the router 50-1. The router 50-1 forwards the STUN packet addressed to the port number "2001" received from the STUN server 70 to the port number "5001" of the user terminal 10-1 by using the port forwarding set as the third session. .. As a result, the communication control unit 140 can receive the STUN packet from the STUN server 70 via the router 50-1.

ポート番号決定部141は、受信したSTUNパケットに、ルータ50−1のポート番号「2001」が含まれるか否かを判定する(S114)。判定結果が偽である場合、図6に示す処理は終了する。この場合、通信制御部140は、第3セッションが正しく設定されなかったことを確認する。一方、判定結果が真の場合、通信制御部140は、第3セッションを用いて送信したSTUNパケットに対する返答であるSTUNパケットの受信に成功したことを特定する(S116)。これにより、通信制御部140は、第3セッションが正しくルータ50−1に設定されたこと、すなわちルータ50−1がポート番号「2001」を利用可能であることを確認する。言い換えれば、通信制御部140は、第3セッションを用いてSTUNパケットをサーバ70に送信した後、ポート番号「2001」を含むSTUNパケットをサーバ70から受信した場合、ポート番号「2001」に対応したUPnPによるポートフォワーディングがルータ50−1に正しく設定されたことを確認する。 The port number determination unit 141 determines whether or not the received STUN packet includes the port number “2001” of the router 50-1 (S114). If the determination result is false, the process shown in FIG. 6 ends. In this case, the communication control unit 140 confirms that the third session has not been set correctly. On the other hand, when the determination result is true, the communication control unit 140 identifies that the STUN packet, which is a response to the STUN packet transmitted using the third session, has been successfully received (S116). As a result, the communication control unit 140 confirms that the third session is correctly set in the router 50-1, that is, the router 50-1 can use the port number "2001". In other words, when the communication control unit 140 receives the STUN packet including the port number "2001" from the server 70 after transmitting the STUN packet to the server 70 using the third session, the communication control unit 140 corresponds to the port number "2001". Confirm that port forwarding by UPnP is correctly set in router 50-1.

この後、通信制御部140は、P2P通信のための準備処理が完了したことを、ゲーム管理部130に通知する。ゲーム管理部130は、この通知に基づいて、対戦ゲームのマッチング要求をSTUNサーバ70に送信するように、通信制御部140に指示する。通信制御部140は、この指示に基づいて、ポート番号「2001」に対応したポートフォワーディングを用いて、対戦ゲームのマッチング要求をゲームサーバ30に送信する(S118)。第3セッションに有効期限はないため、ルータ50−1またはユーザ端末10−1が明示的に第3セッションを開放しない限り、永続的にルータ50−1に設定され続ける。そこで、通信制御部140は、第3セッションとしてゲームサーバ30に設定済みのポートフォワーディングを用いて、マッチング要求を送信する。これにより、ルータ50−1は、ユーザ端末10−1から受信したマッチング要求の送信元アドレスおよび送信元を、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「5001」から、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2001」に変換する。その結果、ルータ50−1は、送信元アドレスおよびポート番号としてルータ50−1のIPアドレス「22.22.22.1」およびポート番号「2001」を含むマッチング要求を、ゲームサーバ30に転送する。このようにして、通信制御部140は、ルータ50−1を介してマッチング要求をゲームサーバ30に送信することができる。 After that, the communication control unit 140 notifies the game management unit 130 that the preparation process for P2P communication is completed. Based on this notification, the game management unit 130 instructs the communication control unit 140 to transmit a matching request for the competitive game to the STUN server 70. Based on this instruction, the communication control unit 140 transmits a matching request for the competitive game to the game server 30 using port forwarding corresponding to the port number "2001" (S118). Since the third session has no expiration date, it remains permanently set to router 50-1 unless router 50-1 or user terminal 10-1 explicitly releases the third session. Therefore, the communication control unit 140 transmits the matching request by using the port forwarding set in the game server 30 as the third session. As a result, the router 50-1 sets the source address and source of the matching request received from the user terminal 10-1 to the IP address "192.168.10.1" and the port number "5001" of the user terminal 10-1. Is converted to the IP address "22.22.22.1" and the port number "2001" of the router 50-1. As a result, the router 50-1 forwards the matching request including the IP address "22.22.22.1" and the port number "2001" of the router 50-1 as the source address and the port number to the game server 30. .. In this way, the communication control unit 140 can transmit the matching request to the game server 30 via the router 50-1.

本実施形態では、ユーザ端末10−3が、上述した手順と同様の手順に従って、P2P通信のための準備処理を完了するものとする。その際、ユーザ端末10−3は、ルータ50−2のポート番号「4001」に対応したUPnPによるポートフォワーディングを、ルータ50−2に設定する。ユーザ端末10−3は、さらに、UPnPによるポートフォワーディングを用いて、ルータ50−2を介してマッチング要求をゲームサーバ30に送信する。これによりルータ50−2は、送信元アドレスおよびポート番号としてルータ50−2のIPアドレス「22.22.22.2」およびポート番号「4001」を含むマッチング要求を、ゲームサーバ30に転送する。 In the present embodiment, it is assumed that the user terminal 10-3 completes the preparatory process for P2P communication according to the same procedure as the above-mentioned procedure. At that time, the user terminal 10-3 sets the port forwarding by UPnP corresponding to the port number "4001" of the router 50-2 to the router 50-2. The user terminal 10-3 further transmits a matching request to the game server 30 via the router 50-2 by using port forwarding by UPnP. As a result, the router 50-2 forwards the matching request including the IP address "22.22.22.2" and the port number "4001" of the router 50-2 as the source address and the port number to the game server 30.

ゲームサーバ30において、通信制御部330が、ユーザ端末10−1から送信されたマッチング要求と、ユーザ端末10−3から送信されたマッチング要求とを、それぞれ受信する。通信制御部140は、受信した各マッチング要求をマッチング部320に通知する。マッチング部320は、通知受領後の所定のタイミングで、対戦ゲームのマッチング処理を実行する。ここでは、ユーザ端末10−1のユーザと、ユーザ端末10−3のユーザとを、対戦ゲームにおける対戦者としてマッチングしたものとする。 In the game server 30, the communication control unit 330 receives the matching request transmitted from the user terminal 10-1 and the matching request transmitted from the user terminal 10-3, respectively. The communication control unit 140 notifies the matching unit 320 of each received matching request. The matching unit 320 executes the matching process of the battle game at a predetermined timing after receiving the notification. Here, it is assumed that the user of the user terminal 10-1 and the user of the user terminal 10-3 are matched as opponents in the battle game.

通信制御部330は、ユーザ端末10−3から受信したマッチング要求に含まれるIPアドレス「22.22.22.2」およびポート番号「4001」を、ユーザ端末10−3宛に送信されるデータの送信先アドレスおよび送信先ポート番号として特定する。そして、通信制御部330は、IPアドレス「22.22.22.2」およびポート番号「4001」を含むパケットを、ルータ50−1のポート番号「2001」に送信する。同様に、通信制御部330は、ユーザ端末10−1から受信したマッチング要求に含まれるIPアドレス「22.22.22.1」およびポート番号「2001」を、ユーザ端末10−1宛に送信されるデータの送信先アドレスおよび送信先ポート番号として特定する。そして、通信制御部140は、IPアドレス「22.22.22.1」およびポート番号「2001」を含むパケットを、ルータ50−2のポート番号「4001」に送信する。 The communication control unit 330 transmits the IP address "22.22.22.2" and the port number "4001" included in the matching request received from the user terminal 10-3 to the user terminal 10-3. Specify as the destination address and destination port number. Then, the communication control unit 330 transmits a packet including the IP address "22.22.22.2" and the port number "4001" to the port number "2001" of the router 50-1. Similarly, the communication control unit 330 transmits the IP address "22.22.22.1" and the port number "2001" included in the matching request received from the user terminal 10-1 to the user terminal 10-1. Specify as the destination address and destination port number of the data. Then, the communication control unit 140 transmits a packet including the IP address "22.22.22.1" and the port number "2001" to the port number "4001" of the router 50-2.

ルータ50−1は、STUNサーバ70からルータ50−1のポート番号「2001」宛に届いたパケットを、ポート番号「2001」に対応したポートフォワーディングを用いることによって、ユーザ端末10−1のポート番号「5001」に転送する。これにより、ユーザ端末10−1の通信制御部140は、マッチング相手であるユーザ端末10−3に送信されるデータの送信先アドレスおよび送信先ポート番号を含むパケットを、ゲームサーバ30から受信する(S120)。並行して、ルータ50−1は、STUNサーバ70からルータ50−1のポート番号「4001」宛に届いたパケットを、ポート番号「4001」に対応したポートフォワーディングを用いることによって、ユーザ端末10−3のポート番号「5001」に転送する。これにより、ユーザ端末10−3の通信制御部140は、マッチング相手であるユーザ端末10−1に送信されるデータの送信先アドレスおよび送信先ポート番号を含むパケットを、ゲームサーバ30から受信する。 The router 50-1 uses port forwarding corresponding to the port number "2001" for the packet that arrives from the STUN server 70 to the port number "2001" of the router 50-1, so that the port number of the user terminal 10-1 is used. Transfer to "5001". As a result, the communication control unit 140 of the user terminal 10-1 receives the packet including the destination address and the destination port number of the data transmitted to the user terminal 10-3, which is the matching partner, from the game server 30 ( S120). At the same time, the router 50-1 uses port forwarding corresponding to the port number "4001" to deliver the packet delivered from the STUN server 70 to the port number "4001" of the router 50-1, so that the user terminal 10- Transfer to the port number "5001" of 3. As a result, the communication control unit 140 of the user terminal 10-3 receives the packet including the destination address and the destination port number of the data transmitted to the user terminal 10-1 which is the matching partner from the game server 30.

通信制御部140は、受信したパケットをゲーム管理部130に通知する。これにより、ゲーム管理部130は、ユーザ端末10−2のユーザを対戦相手としたオンライン対戦ゲームを開始する。ゲーム管理部130は、対戦ゲームの実行中に、対戦ゲームに関する各種のゲームデータを、随時、通信制御部140に出力する。通信制御部140は、ポート番号「2001」に対応したUPnPによるポートフォワーディングを用いて、ユーザ端末10−3とP2P通信する(S122)。この際、通信制御部140は、対戦ゲームのゲームデータを、ルータ50−1を介して、ルータ50−2のポート番号「4001」に送信する。ルータ50−2は、「4001」に対応したポートフォワーディングによって、ポート番号「4001」宛のゲームデータを、ユーザ端末10−3のポート番号「6001」に転送する。これにより、ユーザ端末10−3は、対戦ゲームに関するゲームデータを、ユーザ端末10−1からP2P通信によって正しく受信することができる。その結果、ユーザ端末10−3のゲーム管理部130は、受信したゲームデータに基づいて、ユーザ端末10−3において対戦ゲームを正常に進行させることができる。 The communication control unit 140 notifies the game management unit 130 of the received packet. As a result, the game management unit 130 starts an online battle game with the user of the user terminal 10-2 as an opponent. The game management unit 130 outputs various game data related to the battle game to the communication control unit 140 at any time during the execution of the battle game. The communication control unit 140 performs P2P communication with the user terminal 10-3 by using port forwarding by UPnP corresponding to the port number "2001" (S122). At this time, the communication control unit 140 transmits the game data of the battle game to the port number “4001” of the router 50-2 via the router 50-1. The router 50-2 transfers the game data addressed to the port number "4001" to the port number "6001" of the user terminal 10-3 by port forwarding corresponding to "4001". As a result, the user terminal 10-3 can correctly receive the game data related to the battle game from the user terminal 10-1 by P2P communication. As a result, the game management unit 130 of the user terminal 10-3 can normally advance the battle game on the user terminal 10-3 based on the received game data.

並行して、ユーザ端末10−3のゲーム管理部130は、対戦ゲームの実行中に、対戦ゲームに関する各種のゲームデータを、随時、ユーザ端末10−3の通信制御部140に出力する。ユーザ端末10−3の通信制御部140は、ポート番号「4001」に対応したUPnPによるポートフォワーディングを用いて、ユーザ端末10−1とP2P通信する。この際、ユーザ端末10−3の通信制御部140は、対戦ゲームのゲームデータを、ルータ50−2を介して、ルータ50−1のポート番号「2001」に送信する。ルータ50−1は、「2001」に対応したポートフォワーディングによって、ポート番号「2001」宛に届いたゲームデータを、ユーザ端末10−1のポート番号「5001」に転送する。これにより、ユーザ端末10−1は、対戦ゲームに関するゲームデータを、ユーザ端末10−3からP2P通信によって正しく受信することができる。その結果、ユーザ端末10−1のゲーム管理部130は、受信したゲームデータに基づいて、ユーザ端末10−1において対戦ゲームを正常に進行させることができる。 At the same time, the game management unit 130 of the user terminal 10-3 outputs various game data related to the battle game to the communication control unit 140 of the user terminal 10-3 at any time during the execution of the battle game. The communication control unit 140 of the user terminal 10-3 performs P2P communication with the user terminal 10-1 by using port forwarding by UPnP corresponding to the port number "4001". At this time, the communication control unit 140 of the user terminal 10-3 transmits the game data of the battle game to the port number "2001" of the router 50-1 via the router 50-2. The router 50-1 transfers the game data delivered to the port number "2001" to the port number "5001" of the user terminal 10-1 by port forwarding corresponding to "2001". As a result, the user terminal 10-1 can correctly receive the game data related to the battle game from the user terminal 10-3 by P2P communication. As a result, the game management unit 130 of the user terminal 10-1 can normally advance the battle game on the user terminal 10-1 based on the received game data.

(主要な作用効果)
本実施形態に係るユーザ端末10−1は、ルータ50−1がSTUNパケットの送信時に用いたポート番号から所定数離れたポート番号を特定し、特定したポート番号に対応したUPnPによるポートフォワーディングをルータ50−1に設定する。ルータ50−1に割り当てられるポート番号群は、一定の連続した番号群であるため、このような番号特定によって、ルータが実際に利用可能なポート番号を特定できる可能性を高められる。さらに、ルータ50−1が使用済みのポート番号「2000」と同じポート番号に対応したポートフォワーディングを設定せずに済むので、ポートフォワーディングを適切にルータ50−1に設定することができる。また、設定したポートフォワーディングを用いたSTUNパケットの送信後、それに対する返答であるSTUNパケットを受信した場合に、すなわちルータ50−1がポート番号「2001」を正常に用いることができることを確認できた場合に、初めてP2P通信を実行する。したがって、ルータが実際の利用可能なポート番号「2001」に対応したポートフォワーディングを用いて、他のユーザ端末10−3と正常にP2P通信することができる。
(Main effects)
The user terminal 10-1 according to the present embodiment specifies a port number that is a predetermined number away from the port number used by the router 50-1 when transmitting a STUN packet, and performs port forwarding by UPnP corresponding to the specified port number. Set to 50-1. Since the port number group assigned to the router 50-1 is a constant continuous number group, such number identification increases the possibility that the router can actually specify the available port number. Further, since the router 50-1 does not have to set the port forwarding corresponding to the same port number as the used port number "2000", the port forwarding can be appropriately set in the router 50-1. In addition, it was confirmed that after sending the STUN packet using the set port forwarding, when the STUN packet that is the response to the STUN packet is received, that is, the router 50-1 can normally use the port number "2001". In this case, P2P communication is executed for the first time. Therefore, the router can normally perform P2P communication with other user terminals 10-3 by using port forwarding corresponding to the actually available port number "2001".

なお、ポートフォワーディング設定部142は、ルータ50−1がポート番号「2001」を使用できない場合、ポートフォワーディングの設定に失敗する。しかし、NAPT機能を有するルータ50−1は、ポートフォワーディングの設定が失敗しても、ユーザ端末10−1に何もエラーを通知しない場合がほとんどである。したがって、ユーザ端末10−1は、ルータ50−1がポート番号「2001」を実際に使用できるか否かを、ルータ50−1の挙動に基づいて直接把握することができない。そこで、上述したように、ポート番号「2001」に対応したポートフォワーディングが実際に機能するか否かをテストすることが有効である。 If the router 50-1 cannot use the port number "2001", the port forwarding setting unit 142 fails to set the port forwarding. However, in most cases, the router 50-1 having a NAT function does not notify the user terminal 10-1 of any error even if the port forwarding setting fails. Therefore, the user terminal 10-1 cannot directly grasp whether or not the router 50-1 can actually use the port number "2001" based on the behavior of the router 50-1. Therefore, as described above, it is effective to test whether or not the port forwarding corresponding to the port number "2001" actually functions.

本実施形態では、上述した所定数が1であるため、ユーザ端末10−1は、ルータが実際に用いたポート番号「2000」の隣のポート番号「2001」を特定する。ルータ50−1に割り当てられるポート番号群は、一定の連続した番号群であるため、ポート番号「2000」が使用可能である場合、その隣のポート番号「2001」も同様に使用可能である可能性が高い。したがって、ユーザ端末10−1は、ルータ50−1が実際に使えるポート番号を特定できる可能性を最大限に高めることができる。 In the present embodiment, since the predetermined number described above is 1, the user terminal 10-1 specifies the port number “2001” next to the port number “2000” actually used by the router. Since the port number group assigned to the router 50-1 is a constant continuous number group, if the port number "2000" can be used, the port number "2001" next to the port number "2001" can be used as well. Highly sexual. Therefore, the user terminal 10-1 can maximize the possibility that the router 50-1 can specify the port number that can actually be used.

本実施形態では、ユーザ端末10−1は、ルータ50−1に設定済みのポートフォワーディングを引き続き用いて、ユーザ端末10−3とP2P通信する。これにより、P2P通信のために、新たなポートフォワーディングを設定せずに済むので、処理負荷を下げると共に、P2P通信開始前の通信ラグを減らすことができる。 In the present embodiment, the user terminal 10-1 continues to use the port forwarding set in the router 50-1 to perform P2P communication with the user terminal 10-3. As a result, it is not necessary to set new port forwarding for P2P communication, so that the processing load can be reduced and the communication lag before the start of P2P communication can be reduced.

〔変形例〕
本実施形態は、以下のように変形することができる。これらの変形例は、後述する実施形態2にも等しく適用される。
[Modification example]
This embodiment can be modified as follows. These modifications are equally applied to the second embodiment described later.

(通信の他の例)
通信制御部140は、ルータ50−1のポート番号「2001」に対応したポートフォワーディングを用いて、通信システム1を構成する各種のサーバ(他のコンピュータ)と通信してもよい。例えば、通信制御部140は、ポート番号「2001」ポートフォワーディングを用いて、ゲームサーバ30(他のコンピュータ)と通信してもよい。この場合、ゲームのシングルプレイのための通信を、安定的に実行することができる。あるいは、通信制御部140は、ポート番号「2001」に対応したポートフォワーディングを用いて、各種のウェブサーのビスを提供するウェブサーバ(他のコンピュータ、不図示)と通信してもよい。このように、ポート番号「2001」に対応したポートフォワーディングを用いた通信は、P2P通信に限らず、任意の形態の通信であり得る。
(Other examples of communication)
The communication control unit 140 may communicate with various servers (other computers) constituting the communication system 1 by using port forwarding corresponding to the port number "2001" of the router 50-1. For example, the communication control unit 140 may communicate with the game server 30 (another computer) by using the port number “2001” port forwarding. In this case, communication for single play of the game can be stably executed. Alternatively, the communication control unit 140 may communicate with a web server (another computer, not shown) that provides various web service services by using port forwarding corresponding to the port number "2001". As described above, the communication using port forwarding corresponding to the port number "2001" is not limited to P2P communication, and may be any form of communication.

なお、ユーザ端末10−1が、TCP(Transmission Control Protocol)に従う通信を実行する場合、通信時にユーザ端末10−1と通信相手とのコネクションが確立されることが前提となる。したがって、ユーザ端末10−1が通信相手に対してパケットを送信した場合、その送信が成功したか否かに関わらず、ユーザ端末10−1に対して通信相手からの応答が必ずある。一方、P2P通信は、UDP(User Datagram Protocol)に従う通信であるため、通信時にユーザ端末10−1と通信相手とのコネクションは確立していない。そのため、ユーザ端末10−1が通信相手に対してパケットを送信した場合、ユーザ端末10−1に対して通信相手からの応答があるとは限らないため、P2P通信の安定した継続が望めない恐れがある。しかし、本実施形態の手法に従ってポートフォワーディングを設定すれば、当該ポートフォワーディングを用いることによって安定したP2P通信を行うことができるので、通信相手からの応答の有無を考慮することなくP2P通信を正常に継続できる。このように、本実施形態の手法によりポートフォワーディングを設定することは、特にP2P通信に対して効果が高い。 When the user terminal 10-1 executes communication according to TCP (Transmission Control Protocol), it is premised that a connection between the user terminal 10-1 and the communication partner is established at the time of communication. Therefore, when the user terminal 10-1 transmits a packet to the communication partner, there is always a response from the communication partner to the user terminal 10-1 regardless of whether or not the transmission is successful. On the other hand, since P2P communication is communication based on UDP (User Datagram Protocol), the connection between the user terminal 10-1 and the communication partner is not established at the time of communication. Therefore, when the user terminal 10-1 transmits a packet to the communication partner, there is not always a response from the communication partner to the user terminal 10-1, and there is a risk that stable continuation of P2P communication cannot be expected. There is. However, if port forwarding is set according to the method of the present embodiment, stable P2P communication can be performed by using the port forwarding, so that P2P communication can be normally performed without considering the presence or absence of a response from the communication partner. You can continue. As described above, setting port forwarding by the method of the present embodiment is particularly effective for P2P communication.

(所定数の他の例)
上述した所定数は、1に限らず、任意の数であり得る。例えば、2〜10までのいずれかの数であってもよい。所定数が1以外の数であっても、ユーザ端末10−1は、ルータ50−1が実際に用いたポート番号「2000」に近いポート番号(たとえば2005)を特定することができる。したがって、ポート番号として、ルータが実際に利用可能な番号を特定できる可能性を高められることに変わりない。
(Predetermined number of other examples)
The predetermined number described above is not limited to 1, and may be any number. For example, it may be any number from 2 to 10. Even if the predetermined number is a number other than 1, the user terminal 10-1 can specify a port number (for example, 2005) close to the port number "2000" actually used by the router 50-1. Therefore, it is still possible to increase the possibility that the router can identify the number that is actually available as the port number.

また、ユーザ端末10−1は、ルータが実際に用いたポート番号「2000」よりも所定数小さいポート番号(例えば1999または1995)を特定してもよい。この場合でも、ユーザ端末10−1は、ルータ50−1が実際に用いたポート番号「2000」に近いポート番号を特定することができるので、ポート番号として、ルータが実際に利用可能な番号を特定できる可能性を高められることに変わりない。 Further, the user terminal 10-1 may specify a port number (for example, 1999 or 1995) that is a predetermined number smaller than the port number "2000" actually used by the router. Even in this case, the user terminal 10-1 can specify a port number close to the port number "2000" actually used by the router 50-1, and therefore, as the port number, a number actually available to the router can be used. It is still possible to increase the possibility of being identified.

(ローカルポート番号のランダム決定)
ポート番号決定部141は、第3セッションを設定するためのローカルポート番号を、ランダムに決定してよい。本実施形態では、ポート番号決定部141は、1025〜65536までのいずれかの番号のうちの任意の空き番号を、ローカルポート番号として用いることができる。例えば、ポート番号決定部141は、ポート番号「10425」をランダムに決定したとする。この場合、ポート番号決定部141は、ルータ50−1のポート番号「2001」およびユーザ端末10−1のポート番号「10425」に対応するUPnPによるポートフォワーディングを、ルータ50−1に設定する。これにより、ユーザ端末10−1のポート番号が、ルータ50−1に接続される他の装置のポート番号と競合する可能性を低減することができる。
(Random determination of local port number)
The port number determination unit 141 may randomly determine a local port number for setting the third session. In the present embodiment, the port number determination unit 141 can use any free number from 102 to 65536 as the local port number. For example, it is assumed that the port number determination unit 141 randomly determines the port number "10425". In this case, the port number determination unit 141 sets the port forwarding by UPnP corresponding to the port number "2001" of the router 50-1 and the port number "10425" of the user terminal 10-1 to the router 50-1. This makes it possible to reduce the possibility that the port number of the user terminal 10-1 conflicts with the port number of another device connected to the router 50-1.

例えば、ユーザ端末10−1およびユーザ端末10−2に加えて、通信機能を有する他の電子機器が、ルータ50−1に接続されているとする。さらに、他の電子機器は、固定のポート番号「5001」を用いる仕様の機器であるとする。この場合、ポート番号決定部141が、第3セッション用のポート番号として上述した固定のポート番号「5001」を決定すると、他の電子機器が用いる固定のポート番号「5001」と競合してしまう。ポート番号決定部141が、ユーザ端末10−1のポート番号をランダムに決定すれば、ポート番号が「5001」決定される確率は1/(65536−1025)となるため、他の電子機器と同一のポート番号「5001」が決定される可能性は大幅に低減することになる。 For example, in addition to the user terminal 10-1 and the user terminal 10-2, it is assumed that another electronic device having a communication function is connected to the router 50-1. Further, it is assumed that the other electronic device is a device having a specification using a fixed port number "5001". In this case, if the port number determining unit 141 determines the fixed port number "5001" described above as the port number for the third session, it conflicts with the fixed port number "5001" used by other electronic devices. If the port number determination unit 141 randomly determines the port number of the user terminal 10-1, the probability that the port number is determined as "5001" is 1 / (65536-1025), which is the same as other electronic devices. The possibility that the port number "5001" will be determined will be greatly reduced.

(ローカルポート番号決定の他例)
上述したようにローカルポート番号をランダムに決定する例では、1/(65536−1025)の確率で、ユーザ端末10−2と同一のポート番号が決定される可能性がある。したがって、ポート番号が競合する可能性は僅かながら残される。そこで、ポート番号決定部141は、ルータ50−1のポート番号「2001」を決定した後、これと同一のローカルポート番号「2001」を決定してもよい。この場合、ポートフォワーディング設定部142は、ルータ50−1のポート番号「2001」およびユーザ端末10−1のポート番号「2001」に対応するUPnPによるポートフォワーディングを、ルータ50−1に設定する。
(Another example of determining the local port number)
In the example of randomly determining the local port number as described above, there is a possibility that the same port number as the user terminal 10-2 is determined with a probability of 1 / (65536-1025). Therefore, there is a small possibility of port number conflicts. Therefore, the port number determination unit 141 may determine the port number "2001" of the router 50-1, and then determine the same local port number "2001". In this case, the port forwarding setting unit 142 sets the port forwarding by UPnP corresponding to the port number "2001" of the router 50-1 and the port number "2001" of the user terminal 10-1 to the router 50-1.

例えば、ユーザ端末10−1およびユーザ端末10−2が、いずれも、UPnPによるポートフォワーディングをルータ50−1に設定することを想定する。この際、ユーザ端末10−1は、ルータ50−1のポート番号「2001」を特定し、ユーザ端末10−2は、ルータ50−1のポート番号「2021」を特定するものとする。これらのポート番号は、ルータ50−1が実際に用いた異なるポート番号「2000」および「2020」と所定数異なる番号としてそれぞれ特定されるので、互いに相違することが保証される。 For example, it is assumed that both the user terminal 10-1 and the user terminal 10-2 set port forwarding by UPnP on the router 50-1. At this time, the user terminal 10-1 shall specify the port number "2001" of the router 50-1, and the user terminal 10-2 shall specify the port number "2021" of the router 50-1. Since these port numbers are specified as different numbers by a predetermined number from the different port numbers "2000" and "2020" actually used by the router 50-1, they are guaranteed to be different from each other.

本例では、ユーザ端末10−1は、ルータ50−1のポート番号「2001」と同一のローカルポート番号「2001」を決定し、ユーザ端末10−2は、ルータ50−1のポート番号「2021」と同一のローカルポート「2021」を決定する。このように、ユーザ端末10−1およびユーザ端末10−2が、ルータ50−1の互いに異なるポート番号を特定しているので、ユーザ端末10−1およびユーザ端末10−2が、互いに相違するローカルポート番号が決定することが保証される。これにより、ユーザ端末10−1がUPnPによるポートフォワーディングを設定するために用いるポート番号が、同一のルータ50−1に接続されるユーザ端末10−2がUPnPによるポートフォワーディングを設定するために用いるポート番号と競合することを、回避することができる。さらには、ローカルポート番号を決定するための所定のアルゴリズムに基づく処理(例えばランダムに決定)の実行が不要になるため、プログラム容量を削減したり、通信処理を高速化したりすることが可能になる。 In this example, the user terminal 10-1 determines the same local port number "2001" as the port number "2001" of the router 50-1, and the user terminal 10-2 determines the port number "2021" of the router 50-1. The same local port "2021" as "" is determined. In this way, since the user terminal 10-1 and the user terminal 10-2 specify different port numbers of the router 50-1, the user terminal 10-1 and the user terminal 10-2 are different from each other in the local area. It is guaranteed that the port number will be determined. As a result, the port number used by the user terminal 10-1 to set the port forwarding by UPnP is the port used by the user terminal 10-2 connected to the same router 50-1 to set the port forwarding by UPnP. Conflicts with numbers can be avoided. Furthermore, since it is not necessary to execute a process (for example, randomly determined) based on a predetermined algorithm for determining the local port number, it is possible to reduce the program capacity and speed up the communication process. ..

(通信方法の他の例)
図7は、本実施形態に係るユーザ端末10が実行する他の通信方法の処理手順を示すフローチャートである。本実施形態に係るユーザ端末10は、図7に示す一連の処理を実行することもできる。図7のS1100〜S1104までの各処理は、図6のS100〜S104までの各処理と同一であるため、詳細な説明を省略する。
(Other examples of communication methods)
FIG. 7 is a flowchart showing a processing procedure of another communication method executed by the user terminal 10 according to the present embodiment. The user terminal 10 according to the present embodiment can also execute a series of processes shown in FIG. 7. Since each process from S1100 to S1104 in FIG. 7 is the same as each process from S100 to S104 in FIG. 6, detailed description thereof will be omitted.

図7の例では、ユーザ端末10−1は、第1セッションおよび第2セッションが自動的に設定された後、ユーザ端末10−3とP2P通信するための第3セッションおよび第4セッションをルータ50−1に設定する。まず、ポート番号決定部141は、STUNパケットから特定したポート番号「2000」よりも所定数大きいポート番号と、所定数小さいポート番号とをそれぞれ決定する。ここでは所定数は1である。したがって、ポート番号決定部141は、ポート番号「2000」よりも1つ大きいルータ50−1のポート番号「2001」と、ポート番号「2000」よりも1つ小さいポート番号「1999」(第3ポート番号)とを特定する(S1106)。 In the example of FIG. 7, the user terminal 10-1 sets the first session and the second session automatically, and then the router 50 sets the third session and the fourth session for P2P communication with the user terminal 10-3. Set to -1. First, the port number determination unit 141 determines a port number that is a predetermined number larger than the port number "2000" specified from the STUN packet and a port number that is a predetermined number smaller, respectively. Here, the predetermined number is 1. Therefore, the port number determination unit 141 has a port number "2001" of the router 50-1 which is one larger than the port number "2000" and a port number "1999" (third port) which is one smaller than the port number "2000". (Number) and (S1106).

ポートフォワーディング設定部142は、特定されたポート番号「2001」に対応する第1ポートフォワーディングと、特定されたポート番号「1999」に対応する第2ポートフォワーディングとを、それぞれルータ50−1に並列に設定する(S108)。ここでは、第1ポートフォワーディングを第3セッションとして設定し、第2ポートフォワーディングを第4セッションとして設定する。第1ポートフォワーディングの設定は、図6におけるポートフォワーディングの設定と同一であるため、詳細な説明は省略する。 The port forwarding setting unit 142 parallels the first port forwarding corresponding to the specified port number "2001" and the second port forwarding corresponding to the specified port number "1999" to the router 50-1, respectively. Set (S108). Here, the first port forwarding is set as the third session, and the second port forwarding is set as the fourth session. Since the setting of the first port forwarding is the same as the setting of the port forwarding in FIG. 6, detailed description thereof will be omitted.

第2ポートフォワーディングの設定は、次のようにして実現される。まず、ポート番号決定部141は、ルータ50−1のポート番号「1999」に対応するルータ50−1の新たなローカルポート番号を決定する。ここでは、「5000」よりも1つ小さいポート番号「4999」を特定する。これにより、ルータ50−1は、ユーザ端末10−1のポート番号「4999」およびルータ50−1のポート番号「1999」に対応した第2ポートフォワーディングを、ルータ50−1に設定する。 The setting of the second port forwarding is realized as follows. First, the port number determination unit 141 determines a new local port number of the router 50-1 corresponding to the port number "1999" of the router 50-1. Here, the port number "4999", which is one smaller than "5000", is specified. As a result, the router 50-1 sets the second port forwarding corresponding to the port number "4999" of the user terminal 10-1 and the port number "1999" of the router 50-1 to the router 50-1.

詳細には、ポートフォワーディング設定部142は、ユーザ端末10−1がポート番号「4999」を用いてルータ50−1に送信要求したSTUNパケットの送信元アドレスおよび送信元ポート番号を、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「4999」から、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「1999」に変換するように設定する。ポート番号決定部141は、さらに、ルータ50−1のポート番号「1999」宛に届いたSTUNパケットの送信先アドレスおよびポート番号を、ルータ50−1のIPアドレス「22.22.22.1」およびポート番号「1999」から、ユーザ端末10−1のIPアドレス「192.168.10.1」およびポート番号「4999」に変換するように設定する。 Specifically, the port forwarding setting unit 142 sets the source address and source port number of the STUN packet requested by the user terminal 10-1 to the router 50-1 using the port number "4999" to be set to the user terminal 10-. Set to translate from the IP address "192.168.10.1" and port number "4999" of 1 to the IP address "22.22.22.1" and port number "1999" of router 50-1. .. The port number determination unit 141 further sets the destination address and port number of the STUN packet that arrived at the port number "1999" of the router 50-1 to the IP address "22.22.22.1" of the router 50-1. And the port number "1999" is set to be converted to the IP address "192.168.10.1" and the port number "4999" of the user terminal 10-1.

言い換えれば、ポートフォワーディング設定部142は、ユーザ端末10−1がポート番号「4999」を用いてSTUNサーバ70に送信しようとしたSTUNパケットを、ルータ50−1がポート番号「1999」を用いてSTUNサーバ70に送信したSTUNパケットとしてSTUNサーバ70に転送するようにルータ50−1に設定する。さらに、ルータ50−1のポート番号「1999」宛に届いたSTUNパケットを、ポート番号「4999」を用いるユーザ端末10−1に転送するようにルータ50−1に設定する。 In other words, the port forwarding setting unit 142 sends a STUN packet that the user terminal 10-1 tries to send to the STUN server 70 using the port number "4999", and the router 50-1 uses the port number "1999" to STUN. The router 50-1 is set to be forwarded to the STUN server 70 as a STUN packet transmitted to the server 70. Further, the router 50-1 is set to forward the STUN packet delivered to the port number "1999" of the router 50-1 to the user terminal 10-1 using the port number "4999".

通信制御部140は、設定した各ポートフォワーディングを用いて、各STUNパケットをSTUNサーバ70に送信する(S1110)。詳細には、第3セッションとしてルータ50−1に設定した第1ポートフォワーディングを用いて、STUNパケット(第2信号)をSTUNサーバ70に送信すると共に、第4セッションとしてルータ50−1に設定した第2ポートフォワーディングを用いて、他のSTUNパケット(第3信号)をSTUNサーバ70に送信する。 The communication control unit 140 transmits each STUN packet to the STUN server 70 using each set port forwarding (S1110). Specifically, the STUN packet (second signal) was transmitted to the STUN server 70 using the first port forwarding set in the router 50-1 as the third session, and was set in the router 50-1 as the fourth session. Using the second port forwarding, another STUN packet (third signal) is transmitted to the STUN server 70.

ルータ50−1には第3セッションおよび第4セッションが設定済みであるため、ルータ50−1は、新たなセッションを設定することなく、ユーザ端末10−1から送信要求された各STUNパケットを、ルータ50−1のポート番号「2001」から送信されたSTUNパケットおよびポート番号「1999」から送信されたSTUNパケットとして、STUNサーバ70に転送する。これにより、通信制御部140は、第3セッションに対応する第1ポートフォワーディングを用いてSTUNパケットをSTUNサーバ70に送信すると共に、第4セッションに対応する第2ポートフォワーディングを用いてSTUNパケットをSTUNサーバ70に送信することができる。 Since the third session and the fourth session have already been set in the router 50-1, the router 50-1 sends each STUN packet requested to be transmitted from the user terminal 10-1 without setting a new session. It is transferred to the STUN server 70 as a STUN packet transmitted from the port number "2001" of the router 50-1 and a STUN packet transmitted from the port number "1999". As a result, the communication control unit 140 transmits the STUN packet to the STUN server 70 using the first port forwarding corresponding to the third session, and STUN the STUN packet using the second port forwarding corresponding to the fourth session. It can be sent to the server 70.

STUNサーバ70は、送信元アドレスとしてIPアドレス「22.22.22.1」およびポート番号「2001」を含むSTUNパケットと、送信元アドレスとしてIPアドレス「22.22.22.1」およびポート番号「1999」を含むSTUNパケットとを、ルータ50−1から受信する。STUNサーバ70は、受信した一方のSTUNパケットに含まれるIPアドレス「22.22.22.1」およびポート番号「2001」と、他方のSTUNパケットに含まれるIPアドレス「22.22.22.1」およびポート番号「1999」とを、それぞれを記憶する。STUNサーバ70は、さらに、記憶したIPアドレス「22.22.22.1」およびポート番号「2001」を含むSTUNパケット(第2返答)を、ルータ50−1のポート番号「2001」宛に送信する。STUNサーバ70は、さらに、記憶したIPアドレス「22.22.22.1」およびポート番号「1999」を含む他のSTUNパケット(第3返答)を、ルータ50−1のポート番号「1999」宛に送信する。 The STUN server 70 includes a STUN packet containing an IP address "22.22.22.1" and a port number "2001" as a source address, and an IP address "22.22.22.1" and a port number as a source address. A STUN packet containing "1999" is received from the router 50-1. The STUN server 70 has an IP address "22.22.22.1" and a port number "2001" included in one of the received STUN packets, and an IP address "22.22.22.1" included in the other STUN packet. "And the port number" 1999 "are stored respectively. The STUN server 70 further transmits a STUN packet (second reply) including the stored IP address "22.22.22.1" and the port number "2001" to the port number "2001" of the router 50-1. To do. The STUN server 70 further sends another STUN packet (third reply) including the stored IP address "22.22.22.1" and the port number "1999" to the port number "1999" of the router 50-1. Send to.

通信制御部140は、STUNサーバ70から送信された各STUNパケットを受信する(S1112)。詳細には、STUNサーバ70から送信された一方のSTUNパケットは、ルータ50−1のポート番号「2001」宛に届く。ルータ50−1は、第3セッションとして設定されたポートフォワーディングを用いて、STUNサーバ70から受信したポート番号「2001」宛のSTUNパケットを、ユーザ端末10−1のポート番号「5001」に転送する。また、STUNサーバ70から送信された他方のSTUNパケットは、ルータ50−1のポート番号「1999」宛に届く。 The communication control unit 140 receives each STUN packet transmitted from the STUN server 70 (S1112). Specifically, one STUN packet transmitted from the STUN server 70 arrives at the port number "2001" of router 50-1. The router 50-1 forwards the STUN packet addressed to the port number "2001" received from the STUN server 70 to the port number "5001" of the user terminal 10-1 by using the port forwarding set as the third session. .. Further, the other STUN packet transmitted from the STUN server 70 arrives at the port number "1999" of the router 50-1.

ルータ50−1は、第3セッションとして設定されたポートフォワーディングを用いて、STUNサーバ70から受信したポート番号「2001」宛のSTUNパケットを、ユーザ端末10−1のポート番号「5001」に転送する。ルータ50−1は、さらに、第4セッションとして設定されたポートフォワーディングを用いて、STUNサーバ70から受信したポート番号「1999」宛のSTUNパケットを、ユーザ端末10−1のポート番号「4999」に転送する。これにより、通信制御部140は、ルータ50−1を介して各STUNパケットをSTUNサーバ70から受信することができる。 The router 50-1 forwards the STUN packet addressed to the port number "2001" received from the STUN server 70 to the port number "5001" of the user terminal 10-1 by using the port forwarding set as the third session. .. The router 50-1 further uses the port forwarding set as the fourth session to send the STUN packet addressed to the port number "1999" received from the STUN server 70 to the port number "4999" of the user terminal 10-1. Forward. As a result, the communication control unit 140 can receive each STUN packet from the STUN server 70 via the router 50-1.

なお、通信制御部140は、ルータ50−1のポート番号「2001」宛のSTUNパケットと、ルータ50−1のポート番号「1999」宛のSTUNパケットとのうち少なくともいずれかを受信すればよい。 The communication control unit 140 may receive at least one of the STUN packet addressed to the port number "2001" of the router 50-1 and the STUN packet addressed to the port number "1999" of the router 50-1.

ポート番号決定部141は、受信した一方のSTUNパケットに、ルータ50−1のポート番号「2001」が含まれるか否かを判定する(S1114)。判定結果が真の場合、通信制御部140は、第3セッションを用いて送信したSTUNパケットに対する返答であるSTUNパケットの受信に成功したことを特定する(S1116)。これにより、通信制御部140は、第3セッションが正しくルータ50−1に設定されたこと、すなわちルータ50−1がポート番号「2001」を利用可能であることを確認する。言い換えれば、通信制御部140は、第3セッションを用いてSTUNパケットをサーバ70に送信した後、ポート番号「2001」を含むSTUNパケットをサーバ70から受信した場合、ポート番号「2001」に対応したUPnPによるポートフォワーディングがルータ50−1に正しく設定されたことを確認する。 The port number determination unit 141 determines whether or not the received STUN packet includes the port number “2001” of the router 50-1 (S1114). When the determination result is true, the communication control unit 140 identifies that the STUN packet, which is a response to the STUN packet transmitted using the third session, has been successfully received (S1116). As a result, the communication control unit 140 confirms that the third session is correctly set in the router 50-1, that is, the router 50-1 can use the port number "2001". In other words, when the communication control unit 140 receives the STUN packet including the port number "2001" from the server 70 after transmitting the STUN packet to the server 70 using the third session, the communication control unit 140 corresponds to the port number "2001". Confirm that port forwarding by UPnP is correctly set in router 50-1.

この後実行されるS1118〜S1122までの処理は、図6のS118〜S122までの処理と同一であるため、詳細な説明を省略する。以上のように、通信制御部140は、ポート番号「2001」を含むSTUNパケットを受信した場合、ポート番号「2001」に対応する第1ポートフォワーディングを用いて、ユーザ端末10−3とP2P通信することができる。 Since the processes S1118 to S1122 executed thereafter are the same as the processes S118 to S122 in FIG. 6, detailed description thereof will be omitted. As described above, when the communication control unit 140 receives the STUN packet including the port number "2001", the communication control unit 140 performs P2P communication with the user terminal 10-3 using the first port forwarding corresponding to the port number "2001". be able to.

一方、S1114の判定結果が偽である場合、通信制御部140は、第3セッションが正しく設定されなかったことを確認する。そこで、ポート番号決定部141は、受信した他方のSTUNパケットに、ルータ50−1のポート番号「1999」が含まれるか否かを判定する(S1124)。判定結果が偽である場合、図7に示す処理は終了する。この場合、通信制御部140は、第4セッションが正しく設定されなかったことを確認する。一方、判定結果が真の場合、通信制御部140は、第4セッションを用いて送信したSTUNパケットに対する返答であるSTUNパケットの受信に成功したことを特定する(S1126)。これにより、通信制御部140は、第4セッションが正しくルータ50−1に設定されたこと、すなわちルータ50−1がポート番号「1999」を利用可能であることを確認する。言い換えれば、通信制御部140は、第4セッションを用いてSTUNパケットをサーバ70に送信した後、ポート番号「1999」を含むSTUNパケットをサーバ70から受信した場合、ポート番号「1999」に対応したUPnPによるポートフォワーディングがルータ50−1に正しく設定されたことを確認する。 On the other hand, when the determination result of S1114 is false, the communication control unit 140 confirms that the third session has not been set correctly. Therefore, the port number determination unit 141 determines whether or not the other received STUN packet includes the port number “1999” of the router 50-1 (S1124). If the determination result is false, the process shown in FIG. 7 ends. In this case, the communication control unit 140 confirms that the fourth session has not been set correctly. On the other hand, when the determination result is true, the communication control unit 140 identifies that the STUN packet, which is a response to the STUN packet transmitted using the fourth session, has been successfully received (S1126). As a result, the communication control unit 140 confirms that the fourth session is correctly set in the router 50-1, that is, the router 50-1 can use the port number "1999". In other words, when the communication control unit 140 receives the STUN packet including the port number "1999" from the server 70 after transmitting the STUN packet to the server 70 using the fourth session, the communication control unit 140 corresponds to the port number "1999". Confirm that port forwarding by UPnP is correctly set in router 50-1.

この後実行されるS1128〜S1132までの処理は、通信制御部140が、ゲームサーバ30との通信およびユーザ端末10−3とのP2P通信のために、ポート番号「1999」に対応する第2ポートフォワーディングを用いる点を除き、本質的にS1118〜S1122までの処理と同一であるため、詳細な説明は省略する。以上のように、通信制御部140は、ポート番号「1999」を含むSTUNパケットを受信した場合、ポート番号「1999」に対応する第2ポートフォワーディングを用いて、ユーザ端末10−3とP2P通信することができる。 In the processing from S1128 to S1132 executed thereafter, the communication control unit 140 is the second port corresponding to the port number "1999" for communication with the game server 30 and P2P communication with the user terminal 10-3. Except for the point that forwarding is used, it is essentially the same as the processes from S1118 to S1122, so detailed description thereof will be omitted. As described above, when the communication control unit 140 receives the STUN packet including the port number "1999", the communication control unit 140 performs P2P communication with the user terminal 10-3 by using the second port forwarding corresponding to the port number "1999". be able to.

図7の例では、ユーザ端末10−1は、ルータのポート番号「2000」よりも大きいポート番号「2001」と、ポート番号「2000」よりも小さいポート番号「1999」とをそれぞれ特定するため、ルータが実際に使えるポート番号を特定できる可能性をより高めることができる。例えばポート番号「2000」が、ルートが利用可能な番号群のうち最も大きい番号である場合、ポート番号「2001」はルータが使えない番号になるが、ポート番号「1999」は使える可能性がある。この際、「2001」以外のポート番号として、ポート番号「2001」よりも大きい番号(例えば2002)を特定した場合、ポート番号「2001」が使えなければポート番号「2002」も必ず使えないため、ポートフォワーディングに用いるルータのポート番号の特定のやり直しが生じることになり、非効率である。本例では、このような問題の発生を未然に避けることができる。 In the example of FIG. 7, the user terminal 10-1 identifies a port number “2001” that is larger than the port number “2000” of the router and a port number “1999” that is smaller than the port number “2000”, respectively. It is possible to increase the possibility that the router can identify the port number that can actually be used. For example, if the port number "2000" is the largest number in the available number group for the route, the port number "2001" is a number that cannot be used by the router, but the port number "1999" may be usable. .. At this time, if a number larger than the port number "2001" (for example, 2002) is specified as a port number other than "2001", the port number "2002" cannot be used unless the port number "2001" can be used. It is inefficient because it causes a specific redo of the port number of the router used for port forwarding. In this example, it is possible to avoid the occurrence of such a problem.

また、図7の例では、ユーザ端末10−1は、第1ポートフォワーディングおよび第2ポートフォワーディングをルータ50−1に並列に設定するため、各ポートフォワーディングが有効であるか否かを、並行して確認することができる。したがって、ポート番号「2001」およびポート番号「1999」のうちいずれをルータが利用できるのかを、より素早く特定することができる。 Further, in the example of FIG. 7, since the user terminal 10-1 sets the first port forwarding and the second port forwarding in parallel with the router 50-1, whether or not each port forwarding is effective is checked in parallel. Can be confirmed. Therefore, it is possible to more quickly identify which of the port number "2001" and the port number "1999" can be used by the router.

なお、ポートフォワーディング設定部142は、第1ポートフォワーディングと、第2ポートフォワーディングとを、個別にかつ順番にルータ50−1に設定してもよい。この場合、通信制御部140は、まず例えばポート番号「2001」に対応する第1ポートフォワーディングのみをルータ50−1に設定し、それからポート番号「2001」を含むSTUNパケットの受信に成功するか否かを判定する。成功した場合、すなわちポート番号「2001」を含むSTUNパケットを受信した場合、第1ポートフォワーディングを用いてユーザ端末10−3とP2P通信する。したがって、第2ポートフォワーディングをルータ50−1に設定せずに済むので、処理負荷を下げることができる。通信制御部140は、第1ポートフォワーディングを用いたSTUNパケットの送受信に失敗した場合、次にポート番号「1999」に対応した第2ポートフォワーディングをルータ50−1に設定し、それからポート番号「1999」を含むSTUNパケットの送受信が成功するか否かを判定する。成功した場合、すなわちポート番号「1999」を含むSTUNパケットを受信した場合、第2ポートフォワーディングを用いてユーザ端末10−3とP2P通信する。 The port forwarding setting unit 142 may set the first port forwarding and the second port forwarding to the router 50-1 individually and in order. In this case, the communication control unit 140 first sets only the first port forwarding corresponding to the port number "2001" in the router 50-1, and then succeeds in receiving the STUN packet including the port number "2001". Is determined. If successful, that is, if a STUN packet including the port number "2001" is received, P2P communication is performed with the user terminal 10-3 using the first port forwarding. Therefore, since it is not necessary to set the second port forwarding to the router 50-1, the processing load can be reduced. When the communication control unit 140 fails to send and receive STUN packets using the first port forwarding, it then sets the second port forwarding corresponding to the port number "1999" to the router 50-1, and then sets the port number "1999". It is determined whether or not the transmission / reception of the STUN packet including "is successful". If successful, that is, if a STUN packet including the port number "1999" is received, P2P communication is performed with the user terminal 10-3 using the second port forwarding.

図7の例では、通信制御部140は、ポート番号「2001」を含むSTUNパケットの受信と、ポート番号「1999」を含むSTUNパケットの受信とを両方とも受信した場合、第1ポートフォワーディングおよび第2ポートフォワーディングのうち所望のいずれかを用いてユーザ端末10−3とP2P通信すればよい。 In the example of FIG. 7, when the communication control unit 140 receives both the reception of the STUN packet including the port number "2001" and the reception of the STUN packet including the port number "1999", the first port forwarding and the first port forwarding P2P communication with the user terminal 10-3 may be performed using any of the two port forwardings desired.

〔実施形態2〕
図8は、本発明の第2実施形態に係るゲームシステム1Aの構成の一例を示すブロック図である。ゲームシステム1Aは、ユーザ端末10−1、ユーザ端末10−2、ユーザ端末10−3、ゲームサーバ30、ルータ50−1、ルータ50−2、STUNサーバ70、リレールータ90−1、およびリレールータ90−2を備えている。これらの装置は、ネットワークNWを介して接続される。リレールータ90−1およびリレールータ90−2は同様の構成であるため、特に区別しない場合には、「−1」、「−2」等の記載を省略してリレールータ90として説明する。
[Embodiment 2]
FIG. 8 is a block diagram showing an example of the configuration of the game system 1A according to the second embodiment of the present invention. The game system 1A includes a user terminal 10-1, a user terminal 10-2, a user terminal 10-3, a game server 30, a router 50-1, a router 50-2, a STUN server 70, a relay router 90-1, and a relay router. It is equipped with 90-2. These devices are connected via the network NW. Since the relay router 90-1 and the relay router 90-2 have the same configuration, the relay router 90 will be described by omitting the description of "-1", "-2" and the like unless otherwise specified.

リレールータ90は、通信事業者の設備に設置され、かつIPv4−IPv6変換機能を有するルータである。図8では、リレールータ90−1は、ユーザ端末10−1のユーザが契約する通信事業者の設備に設置され、リレールータ90−2は、ユーザ端末10−3のユーザが契約する通信事業者の設備に設置される。ルータ50−1は、リレールータ90−1を介してネットワークNWに接続され、ルータ50−2は、リレールータ90−2を介してネットワークNWに接続される。 The relay router 90 is a router installed in the equipment of a telecommunications carrier and having an IPv4-IPv6 conversion function. In FIG. 8, the relay router 90-1 is installed in the equipment of the telecommunications carrier contracted by the user of the user terminal 10-1, and the relay router 90-2 is the telecommunications carrier contracted by the user of the user terminal 10-3. It is installed in the equipment of. The router 50-1 is connected to the network NW via the relay router 90-1, and the router 50-2 is connected to the network NW via the relay router 90-2.

図8では、ユーザ端末10とルータ50との通信はIPv4を用いて行われ、ルータ50とリレールータ90との通信は、IPv6を用いて行われ、ネットワークNWを介したリレールータ90と他の装置(STUNサーバ70など)との通信は、IPv4を用いて行われる。ルータ50は、NAPT機能に加えて、IPv4−IPv6変換機能をさらに有する。したがって、UPnPに対応したポートフォワーディングが設定されるのは、リレールータ90ではなく、NAPT機能を有するルータ50の方である。 In FIG. 8, communication between the user terminal 10 and the router 50 is performed using IPv4, communication between the router 50 and the relay router 90 is performed using IPv6, and the relay router 90 and other devices via the network NW are used. Communication with the device (STUN server 70 or the like) is performed using IPv4. The router 50 further has an IPv4-IPv6 conversion function in addition to the NAPT function. Therefore, it is not the relay router 90 but the router 50 having the NAPT function that the port forwarding corresponding to UPnP is set.

上述したIPv4−IPv6変換機能として、例えば、MAP−E(Mapping of Address and Port Encapsulation)が挙げられる。この例では、ルータ50は、ユーザ端末10から受信したIPv4のパケットを、IPv6のパケットでカプセル化することによって、IPv6のネットワークを通過可能なIPv6のパケットに変換する。ルータ50は、変換後のIPv6のパケットをリレールータ90に転送する。リレールータ90は、ルータ50から受信したIPv6のパケットのカプセル化を解除することによって、ネットワークNWを通過可能なIPv4のパケットに変換する。これにより、リレールータ90は、変換後のIPv4のパケットを、STUNサーバ70などの送信先に正しく転送することができる。 Examples of the IPv4-IPv6 conversion function described above include MAP-E (Mapping of Address and Port Encapsulation). In this example, the router 50 converts the IPv4 packet received from the user terminal 10 into an IPv6 packet that can pass through the IPv6 network by encapsulating the IPv4 packet with the IPv6 packet. The router 50 forwards the converted IPv6 packet to the relay router 90. The relay router 90 decapsulates the IPv6 packet received from the router 50 to convert it into an IPv4 packet that can pass through the network NW. As a result, the relay router 90 can correctly forward the converted IPv4 packet to a destination such as the STUN server 70.

また、リレールータ90は、STUNサーバ70などの送信元から受信したIPv4のパケットを、IPv6のパケットでカプセル化することによって、IPv6のネットワークを通過可能なIPv6のパケットに変換する。リレールータ90は、変換後のIPv6のパケットをルータ50に転送する。ルータ50は、リレールータ90から受信したIPv6のパケットのカプセル化を解除することによって、ユーザ端末10−1接続される配プライベートネットワークを通過可能なIPv4のパケットに変換する。これにより、ルータ50−1は、変換後のIPv4のパケットを、ユーザ端末10に正しく転送することができる。 Further, the relay router 90 converts the IPv4 packet received from the source such as the STUN server 70 into an IPv6 packet that can pass through the IPv6 network by encapsulating the IPv4 packet with the IPv6 packet. The relay router 90 forwards the converted IPv6 packet to the router 50. By decapsulating the IPv6 packet received from the relay router 90, the router 50 converts it into an IPv4 packet that can pass through the distribution private network connected to the user terminal 10-1. As a result, the router 50-1 can correctly forward the converted IPv4 packet to the user terminal 10.

図8に示すようなIPv4およびIPv6が共存した通信システム1では、1つのリレールータ90に対して複数のルータ50が接続される。さらに、それぞれのルータ50には、同一のグローバルIPアドレスが割り当てられると共に、各ルータ50に対して一定数のポート番号が割り当てられる。したがって、ルータ50が利用可能なポート番号が制限される。換言すれば、ルータ50が利用可能なポート番号の数は、実施形態1の場合に比べて大幅に少なくなる。また、IPv4およびIPv6が共存下では、各ルータ50に対して、一定数の連続したまとまった数のポート番号が割り当てられる。 In the communication system 1 in which IPv4 and IPv6 coexist as shown in FIG. 8, a plurality of routers 50 are connected to one relay router 90. Further, the same global IP address is assigned to each router 50, and a fixed number of port numbers are assigned to each router 50. Therefore, the port numbers that can be used by the router 50 are limited. In other words, the number of port numbers that can be used by the router 50 is significantly smaller than that of the first embodiment. Further, in the coexistence of IPv4 and IPv6, a fixed number of consecutive and a set number of port numbers are assigned to each router 50.

本実施形態では、ユーザ端末10−1が実行する通信方法は、実施形態1における通信方法と基本的に同一である。したがって、ユーザ端末10−1は、ルータ50が利用可能なポート番号が制限される場合であっても、受信したSTUNパケットに含まれるルータ50のポート番号と所定数異なるポート番号を特定することによって、ルータ50が実際に用いることができるポート番号を特定できる可能性を高めることができる。これにより、実施形態1と同様に、UPnPによるポートフォワーディングをルータ50に正しく設定できる可能性を高めることができる。さらに、実施形態1と同様に、ルータが実際に利用可能なポート番号に対応したポートフォワーディングを用いて、ゲームサーバ30と通信したり、他のユーザ端末10−3と正常にP2P通信したりすることができる。 In the present embodiment, the communication method executed by the user terminal 10-1 is basically the same as the communication method in the first embodiment. Therefore, the user terminal 10-1 identifies a port number different from the port number of the router 50 included in the received STUN packet by a predetermined number even when the port number that can be used by the router 50 is limited. , It is possible to increase the possibility that the router 50 can specify the port number that can be actually used. Thereby, as in the first embodiment, it is possible to increase the possibility that the port forwarding by UPnP can be correctly set in the router 50. Further, as in the first embodiment, the router uses port forwarding corresponding to the port number actually available to communicate with the game server 30 or normally perform P2P communication with other user terminals 10-3. be able to.

なお、IPv4−IPv6変換機能は、MAP−Eに限らず、MAP−T(Mapping of Address and Port Translation)であってもよい。 The IPv4-IPv6 conversion function is not limited to MAP-E, and may be MAP-T (Mapping of Address and Port Translation).

〔まとめ〕
以上に例示した形態から、例えば以下の構成が把握される。なお、各態様の理解を容易にするために、以下では、図面の参照符号を便宜的に括弧書で付記するが、本発明を図示の態様に限定する趣旨ではない。
[Summary]
From the above-exemplified form, for example, the following configuration can be grasped. In addition, in order to facilitate understanding of each aspect, reference numerals of the drawings are added in parentheses below for convenience, but the present invention is not intended to be limited to the illustrated aspects.

本発明の一態様に係るプログラムは、通信システム(1)を構成するコンピュータ(10−1)に、NAPT機能を有するルータ(50−1)を介して、第1信号をサーバ(70)に送信するステップ(S100)と、前記第1信号に対する第1返答を、前記サーバ(70)から受信するステップ(S102)と、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータ(50−1)が用いた第1ポート番号を特定するステップ(S104)と、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータ(50−1)に設定するステップ(S108)と、前記ポートフォワーディングを用いて、第2信号を前記サーバ(70)に送信するステップ(S110)と、前記第2信号に対する第2返答を、前記サーバ(70)から受信するステップ(S112)と、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システム(1)を構成する他のコンピュータ(10−3)と通信するステップ(S122)とを実行させる。 The program according to one aspect of the present invention transmits the first signal to the computer (10-1) constituting the communication system (1) via the router (50-1) having the NAPT function to the server (70). Based on the step (S100), the step (S102) of receiving the first response to the first signal from the server (70), and the first response received, the router at the time of transmitting the first signal. The router (50-1) performs the step (S104) of specifying the first port number used by (50-1) and the port forwarding by UPnP corresponding to the second port number different from the first port number by a predetermined number. A step (S108) of setting to (S108), a step (S110) of transmitting a second signal to the server (70) using the port forwarding, and a second response to the second signal from the server (70). When the receiving step (S112) and the second response are received, another computer (10-3) constituting the communication system (1) is used by port forwarding by UPnP corresponding to the second port number. The step (S122) of communicating with is executed.

前記の構成によれば、コンピュータは、ルータが第1信号の送信時に用いた第1ポート番号から所定数離れた第2ポート番号を特定し、第2ポート番号に対応したUPnPによるポートフォワーディングをルータに設定する。ルータに割り当てられるポート番号群は、一定の連続した番号群であるため、このような特定の手法により、第2ポート番号として、ルータが実際に利用可能な番号を特定できる可能性を高められる。さらに、第1ポート番号と同じポート番号に対応したポートフォワーディングを設定せずに済むので、ポートフォワーディングを適切にルータに設定することができる。また、設定したポートフォワーディングを用いた第2信号の送信後、それに対する第2返答を受信した場合に、すなわちルータが第2ポート番号を正常に用いることができることを確認できた場合に、初めて通信を実行する。したがって、ルータが実際の利用可能な第2ポート番号に対応したポートフォワーディングを用いて、他のコンピュータと正常に通信することができる。 According to the above configuration, the computer identifies a second port number that is a predetermined number away from the first port number used by the router when transmitting the first signal, and performs port forwarding by UPnP corresponding to the second port number. Set to. Since the port number group assigned to the router is a constant continuous number group, it is possible to increase the possibility that the router can actually specify the number that can be actually used as the second port number by such a specific method. Further, since it is not necessary to set the port forwarding corresponding to the same port number as the first port number, the port forwarding can be appropriately set in the router. Also, after transmitting the second signal using the set port forwarding, communication is performed for the first time when the second response to it is received, that is, when it is confirmed that the router can use the second port number normally. To execute. Therefore, the router can successfully communicate with other computers using port forwarding corresponding to the actual available second port number.

上述したプログラムにおいて、前記ポートフォワーディングを設定するステップ(S1108)では、前記第1ポート番号よりも前記所定数大きい前記第2ポート番号に対応した第1ポートフォワーディングと、前記第1ポート番号よりも前記所定数小さい第3ポート番号に対応した第2ポートフォワーディングとを、前記ルータ(50−1)に設定し、前記第2信号を送信するステップ(S1110)では、前記第1ポートフォワーディングを用いて前記第2信号を送信すると共に、前記第2ポートフォワーディングを用いて第3信号を送信し、前記第2返答を受信するステップ(S1112)では、前記第2返答と、前記第3信号に対する第3返答とのうち少なくともいずれかを受信し、前記通信するステップ(S1122,S1132)では、前記第2返答を受信した場合、前記第2ポート番号に対応するポートフォワーディングを用いて前記他のコンピュータ(50−3)と通信し、前記第3返答を受信した場合、前記第3ポート番号に対応するポートフォワーディングを用いて前記他のコンピュータ(50−3)と通信することが好ましい。 In the step (S1108) of setting the port forwarding in the above-described program, the first port forwarding corresponding to the second port number, which is a predetermined number larger than the first port number, and the first port forwarding than the first port number. In the step (S1110) of setting the second port forwarding corresponding to the third port number smaller than a predetermined number in the router (50-1) and transmitting the second signal, the first port forwarding is used. In the step (S1112) of transmitting the second signal, transmitting the third signal using the second port forwarding, and receiving the second response, the second response and the third response to the third signal are received. In the step (S1122, S1132) of receiving at least one of the above and communicating, when the second reply is received, the other computer (50-) using the port forwarding corresponding to the second port number. When communicating with 3) and receiving the third reply, it is preferable to communicate with the other computer (50-3) using port forwarding corresponding to the third port number.

前記の構成によれば、コンピュータは、第1ポート番号よりも大きい第2ポート番号と、第1ポート番号よりも小さい第3ポート番号とをそれぞれ特定するため、ルータが実際に使えるポート番号を特定できる可能性をより高めることができる。例えば第1ポート番号が、ルートが利用可能な番号群のうち最も大きい番号である場合、第2ポート番号はルータが使えない番号になるが、第3ポート番号は使える可能性がある。この際、もし第3ポート番号として、第2ポート番号よりも大きい番号を特定した場合、第2ポート番号が使えなければ第3ポート番号も必ず使えないため、ポート番号の特定のやり直しが生じることになり、非効率である。本構成ではこうした不具合が生じないため、効率的にポート番号を特定することができる。 According to the above configuration, the computer identifies the second port number, which is larger than the first port number, and the third port number, which is smaller than the first port number, so that the router can actually use the port number. You can increase the possibility of being able to do it. For example, if the first port number is the largest number in the group of numbers available for the route, the second port number will be a number that cannot be used by the router, but the third port number may be usable. At this time, if a number larger than the 2nd port number is specified as the 3rd port number, the 3rd port number cannot be used unless the 2nd port number can be used, so that the specific port number must be redone. It becomes inefficient. Since such a problem does not occur in this configuration, the port number can be efficiently specified.

上述したプログラムにおいて、前記ポートフォワーディングを設定するステップ(S108)では、前記第1ポートフォワーディングと前記第2ポートフォワーディングとを並列に設定することが好ましい。 In the above-mentioned program, in the step (S108) of setting the port forwarding, it is preferable to set the first port forwarding and the second port forwarding in parallel.

前記の構成によれば、コンピュータは、第2ポート番号および第3ポート番号のうちいずれをルータが利用できるのかを、より素早く特定することができる。 According to the above configuration, the computer can more quickly identify which of the second port number and the third port number is available to the router.

上述したプログラムにおいて、前記通信するステップ(S122)では、前記ルータに設定済みの前記ポートフォワーディングを引き続き用いて、前記他のコンピュータ(50−3)と通信することが好ましい。 In the above-mentioned program, in the communication step (S122), it is preferable to continue to use the port forwarding set in the router to communicate with the other computer (50-3).

前記の構成によれば、コンピュータは、他のコンピュータとの通信のために、新たなポートフォワーディングを設定せずに済むので、処理負荷を下げると共に、通信開始前の通信ラグを減らすことができる。さらには、プライベートIPアドレスが設定されている他のコンピュータと通信することができる。 According to the above configuration, since the computer does not need to set new port forwarding for communication with other computers, it is possible to reduce the processing load and the communication lag before the start of communication. Furthermore, it can communicate with other computers for which a private IP address is set.

上述したプログラムにおいて、前記プログラムは、前記コンピュータ(50−1)に、ローカルポート番号をランダムに決定するステップをさらに実行させ、前記ポートフォワーディングを設定するステップでは、前記ローカルポート番号および前記第2ポート番号に対応したポートフォワーディングを設定することが好ましい。 In the program described above, the program causes the computer (50-1) to further perform a step of randomly determining a local port number, and in a step of setting the port forwarding, the local port number and the second port. It is preferable to set the port forwarding corresponding to the number.

前記の構成によれば、コンピュータがルータに第2信号を送信する際の用いるローカルポート番号が、同じルータに接続される他の装置が用いるローカルポート番号と競合する可能性を低減することができる。 According to the above configuration, it is possible to reduce the possibility that the local port number used by the computer when transmitting the second signal to the router conflicts with the local port number used by other devices connected to the same router. ..

上述したプログラムにおいて、前記プログラムは、前記コンピュータに、前記第2ポート番号と同一のローカルポート番号を決定するステップをさらに実行させ、前記ポートフォワーディングを設定するステップでは、前記ローカルポート番号および前記第2ポート番号に対応したポートフォワーディングを設定することが好ましい。 In the program described above, the program causes the computer to further perform a step of determining a local port number that is the same as the second port number, and in a step of setting the port forwarding, the local port number and the second port number. It is preferable to set port forwarding corresponding to the port number.

前記の構成によれば、各コンピュータが用いるローカルポート番号が競合することを回避することができる。 According to the above configuration, it is possible to avoid conflicting local port numbers used by each computer.

本発明の一態様に係る通信装置は、通信システム(1)を構成する通信装置(10−1)であって、NAPT機能を有するルータ(50−1)を介して、第1信号をサーバ(70)に送信する第1送信部(140)と、前記第1信号に対する第1返答を、前記サーバ(70)から受信する第1受信部(140)と、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータ(50−1)が用いた第1ポート番号を特定する特定部(141)と、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータ(50−1)に設定する設定部(142)と、前記ポートフォワーディングを用いて、第2信号を前記サーバ(70)に送信する第2送信部(140)と、前記第2信号に対する第2返答を、前記サーバ(70)から受信する第2受信部(140)と、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システム(1)を構成する他の通信装置(10−3)と通信する通信部(140)とを備えている。 The communication device according to one aspect of the present invention is a communication device (10-1) constituting the communication system (1), and sends a first signal to a server (50-1) via a router (50-1) having a NAPT function. Based on the first transmitting unit (140) transmitting to the 70), the first receiving unit (140) receiving the first response to the first signal from the server (70), and the first response received. , A specific unit (141) that specifies the first port number used by the router (50-1) when transmitting the first signal, and UPnP corresponding to a second port number that is a predetermined number different from the first port number. A setting unit (142) that sets port forwarding to the router (50-1), a second transmission unit (140) that transmits a second signal to the server (70) using the port forwarding, and the above. When the second response to the second signal is received from the second receiver (140) received from the server (70), and when the second response is received, port forwarding by UPnP corresponding to the second port number is used. A communication unit (140) that communicates with other communication devices (10-3) constituting the communication system (1) is provided.

前記の構成によれば、上述したプログラムと同様の作用効果を奏する。 According to the above configuration, the same operation and effect as the above-mentioned program is obtained.

また、本発明の一態様に係る通信方法は、通信システム(1)を構成するコンピュータ(10−1)が実行する通信方法であって、NAPT機能を有するルータ(30−1)を介して、第1信号をサーバ(70)に送信するステップ(S100)と、前記第1信号に対する第1返答を、前記サーバ(70)から受信するステップ(S102)と、受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータ(70)が用いた第1ポート番号を特定するステップ(S104)と、前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータ(70)に設定するステップ(S108)と、前記ポートフォワーディングを用いて、第2信号を前記サーバ(70)に送信するステップ(S110)と、前記第2信号に対する第2返答を、前記サーバ(70)から受信するステップ(S112)と、前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システム(1)を構成する他のコンピュータ(10−3)と通信するステップとを含む。 Further, the communication method according to one aspect of the present invention is a communication method executed by a computer (10-1) constituting the communication system (1), via a router (30-1) having a NAPT function. Based on the step (S100) of transmitting the first signal to the server (70), the step (S102) of receiving the first response to the first signal from the server (70), and the received first response. , The step (S104) of specifying the first port number used by the router (70) at the time of transmitting the first signal, and port forwarding by UPnP corresponding to the second port number different from the first port number by a predetermined number. A step (S108) of setting the router (70), a step (S110) of transmitting a second signal to the server (70) using the port forwarding, and a second response to the second signal. Others that configure the communication system (1) by using the step (S112) received from the server (70) and the port forwarding by UPnP corresponding to the second port number when the second response is received. Includes a step of communicating with the computer (10-3).

前記の構成によれば、上述したプログラムと同様の作用効果を奏する。 According to the above configuration, the same operation and effect as the above-mentioned program is obtained.

〔ソフトウェアまたはハードウェアによる実現例〕
上述した実施形態および各変形例では、ユーザ端末10の機能構成が、ソフトウェアにより実現される例について説明した。すなわち、本発明の目的を達成するためにユーザ端末10によって実行されるプログラムが、図2に示したユーザ端末10の記憶部15に記憶され、ユーザ端末10のCPU11が当該プログラムを読み取って実行することにより、ユーザ端末10の機能構成が実現される。
[Example of implementation by software or hardware]
In the above-described embodiment and each modification, an example in which the functional configuration of the user terminal 10 is realized by software has been described. That is, a program executed by the user terminal 10 in order to achieve the object of the present invention is stored in the storage unit 15 of the user terminal 10 shown in FIG. 2, and the CPU 11 of the user terminal 10 reads and executes the program. Thereby, the functional configuration of the user terminal 10 is realized.

なお、この場合、プログラムを記憶する記憶部15としては、「一時的でない有形の媒体」、例えば、ROM(Read Only Memory)等の他、テープ、ディスク、カード、半導体メモリ、プログラマブルな論理回路などを用いることができる。 In this case, the storage unit 15 for storing the program includes a "non-temporary tangible medium" such as a ROM (Read Only Memory), a tape, a disk, a card, a semiconductor memory, a programmable logic circuit, or the like. Can be used.

また、プログラムは、該プログラムを伝送可能な任意の伝送媒体(通信ネットワークや放送波等)を介して前記コンピュータに供給されてもよい。また、本発明の一態様は、プログラムが電子的な伝送によって具現化された、搬送波に埋め込まれたデータ信号の形態でも実現され得る。 Further, the program may be supplied to the computer via an arbitrary transmission medium (communication network, broadcast wave, etc.) capable of transmitting the program. Further, one aspect of the present invention can also be realized in the form of a data signal embedded in a carrier wave, in which the program is embodied by electronic transmission.

なお、ユーザ端末10の機能構成は、ソフトウェアによる実現に限らず、集積回路(ICチップ)等に形成された論理回路(ハードウェア)によって実現されてもよい。 The functional configuration of the user terminal 10 is not limited to the realization by software, but may be realized by a logic circuit (hardware) formed in an integrated circuit (IC chip) or the like.

本開示は上述した各実施形態に限定されるものではなく、請求項に示した範囲で種々の変更が可能であり、異なる実施形態にそれぞれ開示された技術的手段を適宜組み合わせて得られる実施形態についても本開示の技術的範囲に含まれる。さらに、各実施形態にそれぞれ開示された技術的手段を組み合わせることにより、新しい技術的特徴を形成できる。 The present disclosure is not limited to the above-described embodiments, and various modifications can be made within the scope of the claims, and the embodiments obtained by appropriately combining the technical means disclosed in the different embodiments. Is also included in the technical scope of the present disclosure. Furthermore, new technical features can be formed by combining the technical means disclosed in each embodiment.

1、1A ゲームシステム
10、10−1、10−2、10−3 ユーザ端末
11、31 CPU
12、32 通信部
13、33 入力部
14 表示部
15、34 記憶部
30 ゲームサーバ
50、50−1、50−2、50−3 ルータ
70 STUNサーバ
90、90−1、90−2 リレールータ
110 入力受付部
120 表示制御部
130 ゲーム管理部
140、330 通信制御部
141 ポート番号決定部
142 ポートフォワーディング設定部
320 マッチング部
1,1A Game system 10, 10-1, 10-2, 10-3 User terminal 11, 31 CPU
12, 32 Communication unit 13, 33 Input unit 14 Display unit 15, 34 Storage unit 30 Game server 50, 50-1, 50-2, 50-3 Router 70 STUN server 90, 90-1, 90-2 Relay router 110 Input reception unit 120 Display control unit 130 Game management unit 140, 330 Communication control unit 141 Port number determination unit 142 Port forwarding setting unit 320 Matching unit

Claims (8)

通信システムを構成するコンピュータに、
NAPT機能を有するルータを介して、第1信号をサーバに送信するステップと、
前記第1信号に対する第1返答を、前記サーバから受信するステップと、
受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定するステップと、
前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定するステップと、
前記ポートフォワーディングを用いて、第2信号を前記サーバに送信するステップと、
前記第2信号に対する第2返答を、前記サーバから受信するステップと、
前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他のコンピュータと通信するステップとを実行させる、プログラム。
For the computers that make up the communication system
A step of transmitting the first signal to the server via a router having a NAT function,
A step of receiving the first response to the first signal from the server, and
A step of specifying the first port number used by the router when transmitting the first signal based on the received first response, and
A step of setting port forwarding by UPnP corresponding to a second port number different from the first port number by a predetermined number in the router, and
A step of transmitting a second signal to the server using the port forwarding, and
A step of receiving a second response to the second signal from the server, and
When the second reply is received, a program that executes a step of communicating with another computer constituting the communication system by using port forwarding by UPnP corresponding to the second port number.
前記ポートフォワーディングを設定するステップでは、前記第1ポート番号よりも前記所定数大きい前記第2ポート番号に対応した第1ポートフォワーディングと、前記第1ポート番号よりも前記所定数小さい第3ポート番号に対応した第2ポートフォワーディングとを、前記ルータに設定し、
前記第2信号を送信するステップでは、前記第1ポートフォワーディングを用いて前記第2信号を送信すると共に、前記第2ポートフォワーディングを用いて第3信号を送信し、
前記第2返答を受信するステップでは、前記第2返答と、前記第3信号に対する第3返答とのうち少なくともいずれかを受信し、
前記通信するステップでは、
前記第2返答を受信した場合、前記第2ポート番号に対応するポートフォワーディングを用いて前記他のコンピュータと通信し、
前記第3返答を受信した場合、前記第3ポート番号に対応するポートフォワーディングを用いて前記他のコンピュータと通信する、請求項1に記載のプログラム。
In the step of setting the port forwarding, the first port forwarding corresponding to the second port number, which is a predetermined number larger than the first port number, and the third port number, which is a predetermined number smaller than the first port number, are set. The corresponding second port forwarding is set in the router, and
In the step of transmitting the second signal, the second signal is transmitted using the first port forwarding, and the third signal is transmitted using the second port forwarding.
In the step of receiving the second reply, at least one of the second reply and the third reply to the third signal is received.
In the communication step,
When the second reply is received, it communicates with the other computer by using the port forwarding corresponding to the second port number.
The program according to claim 1, wherein when the third reply is received, it communicates with the other computer by using port forwarding corresponding to the third port number.
前記ポートフォワーディングを設定するステップでは、前記第1ポートフォワーディングと前記第2ポートフォワーディングとを並列に設定する、請求項2に記載のプログラム。 The program according to claim 2, wherein in the step of setting the port forwarding, the first port forwarding and the second port forwarding are set in parallel. 前記通信するステップでは、前記ルータに設定済みの前記ポートフォワーディングを引き続き用いて、前記他のコンピュータと通信する、請求項1〜3のいずれか1項に記載のプログラム。 The program according to any one of claims 1 to 3, wherein in the step of communicating, the port forwarding set in the router is continuously used to communicate with the other computer. 前記プログラムは、前記コンピュータに、ローカルポート番号をランダムに決定するステップをさらに実行させ、
前記ポートフォワーディングを設定するステップでは、前記ローカルポート番号および前記第2ポート番号に対応したポートフォワーディングを設定する、請求項1〜4のいずれか1項に記載のプログラム。
The program causes the computer to further perform a step of randomly determining a local port number.
The program according to any one of claims 1 to 4, wherein in the step of setting the port forwarding, the port forwarding corresponding to the local port number and the second port number is set.
前記プログラムは、前記コンピュータに、前記第2ポート番号と同一のローカルポート番号を決定するステップをさらに実行させ、
前記ポートフォワーディングを設定するステップでは、前記ローカルポート番号および前記第2ポート番号に対応したポートフォワーディングを設定する、請求項1〜4のいずれか1項に記載のプログラム。
The program causes the computer to further perform a step of determining a local port number that is the same as the second port number.
The program according to any one of claims 1 to 4, wherein in the step of setting the port forwarding, the port forwarding corresponding to the local port number and the second port number is set.
通信システムを構成する通信装置であって、
NAPT機能を有するルータを介して、第1信号をサーバに第1送信部と、
前記第1信号に対する第1返答を、前記サーバから受信する第1受信部と、
受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定する特定部と、
前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定する設定部と、
前記ポートフォワーディングを用いて、第2信号を前記サーバに送信する第2送信部と、
前記第2信号に対する第2返答を、前記サーバから受信する第2受信部と、
前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他の通信装置と通信する通信部とを備えている、通信装置。
A communication device that constitutes a communication system
The first signal is sent to the server via the router having the NAT function, and the first transmitter and
The first receiving unit that receives the first response to the first signal from the server, and
Based on the received first response, a specific unit that identifies the first port number used by the router when transmitting the first signal, and
A setting unit that sets port forwarding by UPnP corresponding to a second port number different from the first port number by a predetermined number in the router, and
A second transmitter that transmits a second signal to the server using the port forwarding, and
A second receiving unit that receives a second response to the second signal from the server, and
A communication device including a communication unit that communicates with other communication devices constituting the communication system by using port forwarding by UPnP corresponding to the second port number when the second reply is received.
通信システムを構成するコンピュータが実行する通信方法であって、
NAPT機能を有するルータを介して、第1信号をサーバに送信するステップと、
前記第1信号に対する第1返答を、前記サーバから受信するステップと、
受信した前記第1返答に基づいて、前記第1信号の送信時に前記ルータが用いた第1ポート番号を特定するステップと、
前記第1ポート番号と所定数異なる第2ポート番号に対応したUPnPによるポートフォワーディングを、前記ルータに設定するステップと、
前記ポートフォワーディングを用いて、第2信号を前記サーバに送信するステップと、
前記第2信号に対する第2返答を、前記サーバから受信するステップと、
前記第2返答を受信した場合、前記第2ポート番号に対応したUPnPによるポートフォワーディングを用いて、前記通信システムを構成する他のコンピュータと通信するステップとを含む、通信方法。
A communication method executed by the computers that make up the communication system.
A step of transmitting the first signal to the server via a router having a NAT function,
A step of receiving the first response to the first signal from the server, and
A step of specifying the first port number used by the router when transmitting the first signal based on the received first response, and
A step of setting port forwarding by UPnP corresponding to a second port number different from the first port number by a predetermined number in the router, and
A step of transmitting a second signal to the server using the port forwarding, and
A step of receiving a second response to the second signal from the server, and
A communication method including a step of communicating with another computer constituting the communication system by using port forwarding by UPnP corresponding to the second port number when the second reply is received.
JP2019172222A 2019-09-20 2019-09-20 Program, communication device, and communication method Active JP6671676B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019172222A JP6671676B1 (en) 2019-09-20 2019-09-20 Program, communication device, and communication method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019172222A JP6671676B1 (en) 2019-09-20 2019-09-20 Program, communication device, and communication method

Publications (2)

Publication Number Publication Date
JP6671676B1 JP6671676B1 (en) 2020-03-25
JP2021052240A true JP2021052240A (en) 2021-04-01

Family

ID=70000769

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019172222A Active JP6671676B1 (en) 2019-09-20 2019-09-20 Program, communication device, and communication method

Country Status (1)

Country Link
JP (1) JP6671676B1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2022149654A (en) * 2021-03-25 2022-10-07 ヤマハ株式会社 Program for communication, router, server, and communication system
CN113179315B (en) * 2021-04-26 2022-11-29 缀初网络技术(上海)有限公司 Method, system and readable storage medium for providing communication between devices in multiple local area networks

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151142A (en) * 2003-11-14 2005-06-09 Sony Corp Information communication system and method, information processing apparatus, method, program and recording medium
JP2008118599A (en) * 2006-11-08 2008-05-22 Sony Computer Entertainment Inc Communication apparatus, communication control method, and communication control program
WO2013145522A1 (en) * 2012-03-28 2013-10-03 ソニー株式会社 Information processing device, information processing method, and program
WO2015093158A1 (en) * 2013-12-16 2015-06-25 ヤマハ株式会社 Communication system, terminal apparatus, and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005151142A (en) * 2003-11-14 2005-06-09 Sony Corp Information communication system and method, information processing apparatus, method, program and recording medium
JP2008118599A (en) * 2006-11-08 2008-05-22 Sony Computer Entertainment Inc Communication apparatus, communication control method, and communication control program
WO2013145522A1 (en) * 2012-03-28 2013-10-03 ソニー株式会社 Information processing device, information processing method, and program
WO2015093158A1 (en) * 2013-12-16 2015-06-25 ヤマハ株式会社 Communication system, terminal apparatus, and server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
北田裕之,三好匠: "Pure型P2P−VPNにおけるブートストラップ手法", 電子情報通信学会技術研究報告, vol. 第108巻,第17号, JPN6020002657, 17 April 2008 (2008-04-17), JP, ISSN: 0004201709 *

Also Published As

Publication number Publication date
JP6671676B1 (en) 2020-03-25

Similar Documents

Publication Publication Date Title
US10201751B2 (en) Gaming via peer-to-peer networks
US8070603B2 (en) Network game system, network game server, and network game terminal
US20040177158A1 (en) Network address translation techniques for selective network traffic diversion
JP6671676B1 (en) Program, communication device, and communication method
JP2006333245A (en) Network system and communication method
WO2018196468A1 (en) Method, device and terminal for realizing data service
CN110213072B (en) Network equipment control method and network service processing method
CN108234422A (en) Resource regulating method and device
JP2007036624A (en) Communication management apparatus, device, and communication system
US7028104B1 (en) Network access device having internetworking driver with active control
US9413653B2 (en) Communication system and server
JP2013016889A (en) Arcade game system, program, and information storage medium
JP2004186983A (en) Communication controller and communication control method
CN113746715B (en) Method and device for realizing cross-three-layer transmission of two-layer message
JP2009246614A (en) Communication system, terminal, relay device, communication mode determination method, and program
CN111245702B (en) Data transmission method and device based on 5GS, forwarding equipment and UPF communication equipment
JP3905067B2 (en) Communication method between hosts via network
JP2006074302A (en) Key telephone system and voice data communication method
JP7291247B2 (en) Delivery control device, delivery control method and delivery control program
KR101002142B1 (en) Method for providing information service between private IP network and authorization IP network
JP2007104438A (en) Outdoor access system, server, and communication method
US20230283694A1 (en) Data transmission method and apparatus, device, and computer-readable storage medium
KR20070061036A (en) Apparatus and method for sharing media inter homenetworks
JP2004049922A (en) Client-server system
JP6637837B2 (en) Information processing system, information processing program and information processing method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20191028

A871 Explanation of circumstances concerning accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A871

Effective date: 20191101

A975 Report on accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A971005

Effective date: 20191119

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20200204

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200219

R150 Certificate of patent or registration of utility model

Ref document number: 6671676

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250