JP2017011641A - Communication device, communication control method and communication system - Google Patents

Communication device, communication control method and communication system Download PDF

Info

Publication number
JP2017011641A
JP2017011641A JP2015128342A JP2015128342A JP2017011641A JP 2017011641 A JP2017011641 A JP 2017011641A JP 2015128342 A JP2015128342 A JP 2015128342A JP 2015128342 A JP2015128342 A JP 2015128342A JP 2017011641 A JP2017011641 A JP 2017011641A
Authority
JP
Japan
Prior art keywords
stream
identifier
communication device
reuse
communication
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2015128342A
Other languages
Japanese (ja)
Inventor
智哉 酒井
Tomoya Sakai
智哉 酒井
幸夫 沼上
Yukio Numagami
幸夫 沼上
健介 安間
Kensuke Yasuma
健介 安間
國松 亮
Akira Kunimatsu
亮 國松
和矢 谷口
Kazuya Taniguchi
和矢 谷口
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP2015128342A priority Critical patent/JP2017011641A/en
Publication of JP2017011641A publication Critical patent/JP2017011641A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

PROBLEM TO BE SOLVED: To make it difficult to cut off a connection which occurs accompanying the increase of a stream ID in a communication system which establishes a plurality of streams on the connection to perform communication.SOLUTION: A communication device 20 can establish a plurality of streams, which are logical communication paths each having an identifier, on one logical communication channel (connection) established between with a communication device 30. The communication device 20 includes: determination means for determining whether or not the identifier of the already established stream is to be reused; and request means for requesting the communication device 30 to reuse the stream identifier, when the determination means determines to reuse the stream identifier. The communication device 20 further includes set means for setting a stream on the communication channel into a communicable state with the communication device 30, when the determination means determines to reuse the stream identifier.SELECTED DRAWING: Figure 3

Description

本発明は、1つの論理的な通信路上に、識別子が割り当てられた複数の論理的な通信路であるストリームを確立して通信を行う通信装置、通信制御方法及び通信システムに関する。   The present invention relates to a communication apparatus, a communication control method, and a communication system that perform communication by establishing streams, which are a plurality of logical communication paths to which identifiers are assigned, on one logical communication path.

インターネット標準技術として一般に広く利用されているプロトコル(通信規約)の一つに、HTTP/1.1がある。また、インターネット標準化団体(IETF:Internet Engineering Task Force)において、HTTPプロトコルの新しいバージョンであるHTTP/2が策定された。HTTP/2は、SPDY(登録商標)プロトコルをベースとして策定されたプロトコルである。HTTP/2やSPDYでは、クライアントとサーバとの間に1つのTCPコネクション(通信路)を張り、1つのコネクション上で、複数のストリーム(論理的な通信路)を張ることで通信の効率化を行っている。特許文献1には、SPDYプロトコルを用いて複数のストリームでデータ通信を行う情報処理システムが開示されている。なお、各ストリームは、ストリームID(ストリーム識別子)によって識別される。ストリームIDは、新しいストリームが確立されるごとに値が増加する。   One protocol (communication protocol) that is widely used as an Internet standard technology is HTTP / 1.1. In addition, HTTP / 2, a new version of the HTTP protocol, has been formulated by the Internet Engineering Task Force (IETF). HTTP / 2 is a protocol formulated based on the SPDY (registered trademark) protocol. In HTTP / 2 and SPDY, one TCP connection (communication path) is set up between the client and the server, and a plurality of streams (logical communication paths) are set up on one connection to improve communication efficiency. Is going. Patent Document 1 discloses an information processing system that performs data communication with a plurality of streams using the SPDY protocol. Each stream is identified by a stream ID (stream identifier). The stream ID increases every time a new stream is established.

特開2014−21728号公報JP 2014-21728 A

HTTP/2やSPDY等の通信プロトコルにおいて、ストリームIDが上限に達すると、コネクションの切断が発生する可能性がある。しかしながら、コネクションの切断から新たなコネクションが確立されるまでの間、通信相手に通信データのリクエストを発行することができない。また、コネクションの切断と新しいコネクションの確立とには、処理負荷がかかる。
そこで、本発明は、コネクション上に複数のストリームを確立して通信を行う通信システムにおいて、ストリームIDの増加に伴うコネクションの切断を発生しにくくすることを目的としている。
In a communication protocol such as HTTP / 2 or SPDY, when the stream ID reaches the upper limit, the connection may be disconnected. However, a request for communication data cannot be issued to the communication partner from when the connection is disconnected until a new connection is established. In addition, a processing load is applied to disconnecting a connection and establishing a new connection.
Therefore, an object of the present invention is to make it difficult for connection disconnection due to an increase in stream ID to occur in a communication system that establishes a plurality of streams on a connection and performs communication.

上記課題を解決するために、本発明に係る通信装置の一態様は、他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信装置であって、すでに確立されたストリームの識別子を再利用するか否かを判断する判断手段と、前記判断手段により前記ストリームの前記識別子を再利用すると判断した場合に、前記他の通信装置に対して、前記ストリームの前記識別子の再利用を要求する要求手段と、前記判断手段により前記ストリームの前記識別子を再利用すると判断した場合に、前記識別子を再利用して、前記通信路上の前記ストリームを前記他の通信装置との通信が可能な状態に設定する設定手段と、を備える。   In order to solve the above problems, an aspect of a communication apparatus according to the present invention is a logical communication path in which an identifier is assigned to one logical communication path established with another communication apparatus. A communication device capable of establishing a plurality of streams, a determination unit for determining whether or not to reuse an identifier of an already established stream, and a case in which the determination unit determines to reuse the identifier of the stream In addition, when the other communication apparatus determines that the identifier of the stream is to be reused by request means for requesting reuse of the identifier of the stream, the identifier is reused. Setting means for setting the stream on the communication path to a state in which communication with the other communication device is possible.

本発明によれば、コネクション上に複数のストリームを確立して通信を行う通信システムにおいて、ストリームIDの増加に伴うコネクションの切断が発生しにくくなる。   ADVANTAGE OF THE INVENTION According to this invention, in the communication system which establishes a some stream on a connection and communicates, it becomes difficult to generate | occur | produce the disconnection of a connection accompanying the increase in stream ID.

通信システムの一例を示す概略構成図である。It is a schematic block diagram which shows an example of a communication system. 通信装置のハードウェア構成の一例である。It is an example of the hardware constitutions of a communication apparatus. 通信装置(再利用要求側)のモジュール構成を示す図である。It is a figure which shows the module structure of a communication apparatus (reuse request | requirement side). フレームのフォーマットを示す図である。It is a figure which shows the format of a frame. 通信装置(再利用要求の受信側)のモジュール構成を示す図である。It is a figure which shows the module structure of a communication apparatus (reception request receiving side). 通信装置(再利用要求側)の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a communication apparatus (reuse request | requirement side). ストリームIDの再利用要求を表すPINGフレームである。It is a PING frame representing a stream ID reuse request. ストリームIDの再利用要求への応答を表すPINGフレームである。It is a PING frame representing a response to a stream ID reuse request. 通信装置(再利用要求の受信側)の動作を示すフローチャートである。It is a flowchart which shows operation | movement of a communication apparatus (reception request receiving side). ストリームの状態の一例を示す図である。It is a figure which shows an example of the state of a stream. ストリームIDの再利用時のストリームの状態を示す図である。It is a figure which shows the state of the stream at the time of reuse of stream ID. ストリームIDの再利用終了時のストリームの状態を示す図である。It is a figure which shows the state of the stream at the time of completion | finish of reuse of stream ID. 通信装置間のメッセージのやり取りを示すシーケンス図である。It is a sequence diagram which shows the exchange of the message between communication apparatuses.

以下、添付図面を参照して、本発明を実施するための形態について詳細に説明する。
なお、以下に説明する実施の形態は、本発明の実現手段としての一例であり、本発明が適用される装置の構成や各種条件によって適宜修正又は変更されるべきものであり、本発明は以下の実施の形態に限定されるものではない。
本実施形態における通信システムは、複数の通信装置間において双方向に通信が可能なシステムである。本実施形態では、通信プロトコルとして、HTTP/2(Hypertext Transfer Protocol version 2)を使用する。そして、通信装置間において確立した論理的な通信路(以下、「コネクション」という。)上に、双方向に通信可能な複数の論理的な通信路(以下、「ストリーム」という。)を確立し、データ(フレーム)の送受信を行う。
なお、コネクションとは、2つのエンドポイント間(クライアント・サーバ間)のトランスポート層(TCPレイヤ)での接続を意味する。また、ストリームとは、対象とする上位通信プロトコルにおける論理チャネルのことである。さらに、フレームとは、実際にデータを送信する際に、データを細切れにした最少単位のブロックのことである。
DESCRIPTION OF EMBODIMENTS Hereinafter, embodiments for carrying out the present invention will be described in detail with reference to the accompanying drawings.
The embodiment described below is an example as means for realizing the present invention, and should be appropriately modified or changed depending on the configuration and various conditions of the apparatus to which the present invention is applied. It is not limited to the embodiment.
The communication system in the present embodiment is a system capable of bidirectional communication between a plurality of communication devices. In this embodiment, HTTP / 2 (Hypertext Transfer Protocol version 2) is used as a communication protocol. Then, a plurality of logical communication paths (hereinafter referred to as “streams”) capable of bidirectional communication are established on a logical communication path (hereinafter referred to as “connection”) established between the communication apparatuses. Data (frame) is transmitted and received.
The connection means a connection at the transport layer (TCP layer) between two end points (between client and server). A stream is a logical channel in a target upper communication protocol. Further, a frame is a minimum unit block in which data is cut into pieces when data is actually transmitted.

図1は、本実施形態における通信システム10の一例を示す概略構成図である。本実施形態では、通信システム10を店舗内の監視を行う監視カメラシステムに適用する例を説明する。
通信システム10は、通信装置20と通信装置30とを備える。通信装置20と通信装置30とは、ネットワーク40を介して接続されている。本実施形態において、通信装置20は、店舗内に設置されたネットワークカメラ、通信装置30は、パーソナルコンピュータ(PC)によって構成される管理端末とすることができる。通信装置20は、店舗内を撮像し、撮像領域内に不審者が侵入するなどのイベントを検出したとき、検出したイベントを通信装置30へ通知する。なお、本実施形態では、通信装置20がHTTP/2クライアント、通信装置30がHTTP/2サーバとして説明を行うが、逆の構成であってもよい。つまり、通信装置20がHTTP/2サーバ、通信装置30がHTTP/2クライアントであってもよい。また、本実施形態では、通信装置30を1台のPCによって実現しているが、通信装置30は、プロキシサーバを含めてもよいし、クラウド上で分散して配置されていてもよい。
FIG. 1 is a schematic configuration diagram illustrating an example of a communication system 10 according to the present embodiment. In the present embodiment, an example in which the communication system 10 is applied to a surveillance camera system that performs in-store monitoring will be described.
The communication system 10 includes a communication device 20 and a communication device 30. The communication device 20 and the communication device 30 are connected via a network 40. In the present embodiment, the communication device 20 can be a network camera installed in a store, and the communication device 30 can be a management terminal constituted by a personal computer (PC). When the communication device 20 images the inside of the store and detects an event such as a suspicious person entering the imaging area, the communication device 20 notifies the communication device 30 of the detected event. In the present embodiment, the communication device 20 is described as an HTTP / 2 client and the communication device 30 is an HTTP / 2 server, but the configuration may be reversed. That is, the communication device 20 may be an HTTP / 2 server and the communication device 30 may be an HTTP / 2 client. Moreover, in this embodiment, although the communication apparatus 30 is implement | achieved by one PC, the communication apparatus 30 may include a proxy server and may be distributed and arranged on the cloud.

ネットワーク40は、インターネット、WAN(Wide Area Network)、LAN(Local Area Network)、若しくはこれらの複合により実現できる。なお、通信装置10と通信装置20とは、ネットワーク40を介さずに、例えば、無線アドホックネットワークを用いて直接接続してもよい。
また、通信装置20と通信装置30とは、ネットワーク40(通信路)を通じて、HTTP/2を使用して通信を行う。HTTP/2において、ストリームは、31ビットの整数からなるストリーム識別子(ストリームID)によって識別される。本実施形態では、ストリームIDを再利用可能とし、ストリームIDを使い切ってしまった場合であっても、コネクションを接続しなおすことなく、すでに確立されたストリームを再利用して通信を行う。すなわち、通信装置20は、通信装置30(他の通信装置)との間に確立される1つの論理的なコネクション上(通信路上)に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能である。そして、通信装置20は、以下で説明する所定の条件に基づいて、すでに確立済みのストリームに対応するストリームIDを再利用するための制御を実行する。
The network 40 can be realized by the Internet, a WAN (Wide Area Network), a LAN (Local Area Network), or a combination thereof. Note that the communication device 10 and the communication device 20 may be directly connected using, for example, a wireless ad hoc network without going through the network 40.
Moreover, the communication apparatus 20 and the communication apparatus 30 communicate using HTTP / 2 through the network 40 (communication path). In HTTP / 2, a stream is identified by a stream identifier (stream ID) composed of a 31-bit integer. In this embodiment, even when the stream ID is reusable and the stream ID is used up, communication is performed by reusing the already established stream without reconnecting the connection. That is, the communication device 20 sends a stream that is a logical communication path to which an identifier is assigned to one logical connection (communication path) established with the communication apparatus 30 (another communication apparatus). Multiple establishments are possible. Then, the communication device 20 executes control for reusing the stream ID corresponding to the already established stream based on a predetermined condition described below.

図2は、通信装置20のハードウェア構成を示す図である。
通信装置20は、CPU21と、ROM22と、RAM23と、外部メモリ24と、撮像部25と、表示部26と、通信I/F27と、システムバス28とを備える。CPU21は、通信装置20における動作を統括的に制御するものであり、システムバス28を介して、各構成部(22〜27)を制御する。ROM22は、CPU21が処理を実行するために必要なプログラムを記憶する不揮発性メモリである。なお、当該プログラムは、外部メモリ24や着脱可能な記憶媒体(不図示)に記憶されていてもよい。RAM23は、CPU21の主メモリ、ワークエリアとして機能する。すなわち、CPU21は、処理の実行に際してROM22から必要なプログラムをRAM23にロードし、ロードしたプログラムを実行することで各種の機能動作を実現する。
FIG. 2 is a diagram illustrating a hardware configuration of the communication device 20.
The communication device 20 includes a CPU 21, a ROM 22, a RAM 23, an external memory 24, an imaging unit 25, a display unit 26, a communication I / F 27, and a system bus 28. The CPU 21 controls the operation of the communication device 20 in an integrated manner, and controls each component (22 to 27) via the system bus 28. The ROM 22 is a non-volatile memory that stores a program necessary for the CPU 21 to execute processing. The program may be stored in the external memory 24 or a removable storage medium (not shown). The RAM 23 functions as a main memory and work area for the CPU 21. That is, the CPU 21 loads various programs from the ROM 22 to the RAM 23 when executing the processing, and implements various functional operations by executing the loaded programs.

外部メモリ24は、例えば、CPU21がプログラムを用いた処理を行う際に必要な各種データや各種情報を記憶している。また、外部メモリ24には、例えば、CPU21がプログラムを用いた処理を行うことにより得られた各種データや各種情報が記憶される。撮像部25は、被写体の撮像を行うためのものであり、CMOS(Complementary Metal Oxide Semiconductor)、CCD(Charge Coupled Device)等の撮像素子を含んで構成される。表示部26は、液晶ディスプレイ(LCD)等のモニタによって構成される。通信I/F27は、通信相手である通信装置30と通信するためのインターフェースである。
なお、通信装置20が撮像機能を有していない場合には、撮像部25は不要である。また、通信装置30のハードウェア構成は、撮像部25が不要であることを除いては、図2に示す通信装置20のハードウェア構成と同様である。
The external memory 24 stores various data and various information necessary for the CPU 21 to perform processing using a program, for example. The external memory 24 stores various data and various information obtained by the CPU 21 performing processing using a program, for example. The imaging unit 25 is for imaging a subject and includes an imaging element such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD). The display unit 26 is configured by a monitor such as a liquid crystal display (LCD). The communication I / F 27 is an interface for communicating with the communication device 30 that is a communication partner.
If the communication device 20 does not have an imaging function, the imaging unit 25 is not necessary. The hardware configuration of the communication device 30 is the same as the hardware configuration of the communication device 20 illustrated in FIG. 2 except that the imaging unit 25 is not necessary.

以下、通信装置20をストリームIDの再利用を要求する側、通信装置30をストリームIDの再利用の要求を受信する側として説明する。
(通信装置20の構成)
図3は、ストリームIDの再利用を要求する側である通信装置20のモジュール構成を示す図である。通信装置20は、通信制御部201と、表示制御部202と、接続確立部203と、フレーム作成部204と、フレーム受信部205と、フレーム解析部206と、フレーム送信部207と、を備える。さらに、通信装置20は、再利用要求作成部208と、応答解析部209と、再利用可否判断部210と、ストリームID管理部211と、ストリーム処理部212と、再利用要否判断部213と、を備える。これらの各モジュール201〜213は、バス200によって接続されている。
Hereinafter, the communication device 20 will be described as a side requesting reuse of a stream ID, and the communication device 30 as a side receiving a request for reuse of a stream ID.
(Configuration of communication device 20)
FIG. 3 is a diagram illustrating a module configuration of the communication apparatus 20 that requests the reuse of a stream ID. The communication device 20 includes a communication control unit 201, a display control unit 202, a connection establishment unit 203, a frame creation unit 204, a frame reception unit 205, a frame analysis unit 206, and a frame transmission unit 207. Furthermore, the communication device 20 includes a reuse request creation unit 208, a response analysis unit 209, a reuse availability determination unit 210, a stream ID management unit 211, a stream processing unit 212, and a reuse necessity determination unit 213. . These modules 201 to 213 are connected by a bus 200.

通信制御部201は、TCP/IP処理、及びTLS(Transport Layer Security)処理を行う。表示制御部202は、ユーザが通信装置20を操作するためのGUI(Graphical User Interface)を図2の表示部26に表示する。接続確立部203は、通信装置20と通信装置30との間に、HTTP/2によるコネクション(接続)を確立する。コネクションの確立には、プロトコルアップグレードや、コネクションプリフェイスの送受信が含まれる。コネクションを確立すると、通信装置20と通信装置30との間でHTTP/2通信が可能となる。   The communication control unit 201 performs TCP / IP processing and TLS (Transport Layer Security) processing. The display control unit 202 displays a graphical user interface (GUI) for the user to operate the communication device 20 on the display unit 26 in FIG. The connection establishment unit 203 establishes an HTTP / 2 connection (connection) between the communication device 20 and the communication device 30. Establishing a connection includes protocol upgrade and connection pre-face transmission / reception. When the connection is established, HTTP / 2 communication can be performed between the communication device 20 and the communication device 30.

フレーム作成部204は、通信装置20がHTTP/2通信によって確立されたコネクションを介して送信するフレームを作成する。フレームは、図4に示すように、8オクテットのフレームヘッダ51と、0から65535オクテットのフレームペイロード52とにより構成されている。フレームペイロード52の構造及び内容は、フレームタイプ(Type)に応じて異なる。フレーム作成部204は、HEADERSフレーム(Type=0x1)、SETTINGフレーム(Type=0x4)、PUSH_PROMISEフレーム(Type=0x5)、PINGフレーム(Type=0x6)等のフレームを作成可能である。また、フレーム作成部204は、独自に定義した拡張フレームも作成可能である。フレーム受信部205は、通信装置30が送信したフレームを受信する。フレーム解析部206は、フレーム受信部205が受信したフレームの種類(Type)を解析する。フレーム送信部207は、フレーム作成部204が作成したフレームを送信する。   The frame creation unit 204 creates a frame that the communication device 20 transmits via a connection established by HTTP / 2 communication. As shown in FIG. 4, the frame is composed of a frame header 51 of 8 octets and a frame payload 52 of 0 to 65535 octets. The structure and content of the frame payload 52 differ depending on the frame type (Type). The frame creation unit 204 can create frames such as a HEADERS frame (Type = 0x1), a SETTING frame (Type = 0x4), a PUSH_PROMISE frame (Type = 0x5), and a PING frame (Type = 0x6). Also, the frame creation unit 204 can create an extension frame that is uniquely defined. The frame receiving unit 205 receives a frame transmitted from the communication device 30. The frame analysis unit 206 analyzes the type (Type) of the frame received by the frame reception unit 205. The frame transmission unit 207 transmits the frame created by the frame creation unit 204.

再利用要求作成部208は、ストリームIDの再利用を要求するためのフレームを作成する。本実施形態では、通信相手から応答が得られる方法でストリームIDの再利用を要求する。具体的には、PINGフレームを用い、ストリームIDの再利用を要求するオプションをPINGフレームに書き込むことで、ストリームIDの再利用を要求する。ストリームIDの再利用要求を表すPINGフレームのフォーマットについては後述する。
応答解析部209は、ストリームIDの再利用の要求に対する通信装置30からの応答を解析する。本実施形態では、ストリームIDの再利用要求に対する応答にもPINGフレームが用いられる。したがって、応答解析部209は、フレーム受信部205が受信した通信装置30からの応答であるPINGフレームを解析し、PINGフレームに書き込まれたオプションを確認する。再利用可否判断部210は、応答解析部209による解析結果をもとに、ストリームIDの再利用可否を判断する。具体的には、再利用可否判断部210は、通信装置30から再利用を許可する応答を受信したか否かを判断する。
The reuse request creation unit 208 creates a frame for requesting reuse of a stream ID. In the present embodiment, the stream ID is requested to be reused by a method in which a response is obtained from the communication partner. Specifically, the PING frame is used, and an option for requesting reuse of the stream ID is written in the PING frame, thereby requesting reuse of the stream ID. The format of the PING frame representing the stream ID reuse request will be described later.
The response analysis unit 209 analyzes the response from the communication device 30 to the request for reuse of the stream ID. In the present embodiment, the PING frame is also used as a response to the stream ID reuse request. Therefore, the response analysis unit 209 analyzes the PING frame that is the response from the communication device 30 received by the frame reception unit 205, and confirms the option written in the PING frame. The reusability determination unit 210 determines whether the stream ID can be reused based on the analysis result by the response analysis unit 209. Specifically, the reusability determination unit 210 determines whether a response permitting reuse is received from the communication device 30.

ストリームID管理部211は、ストリームIDの管理を行う。ストリームID管理部211は、フレーム作成部204によって新しいストリームを確立(開始)する際に、使用可能であるストリームIDをフレーム作成部204へ提供する。ストリーム処理部212は、ストリームの状態を、idle、open、closedなどの状態に遷移させる処理を行う。また、ストリーム処理部212は、ストリームIDを再利用したストリームの処理として、ストリームIDを再利用したストリームを確立可能な状態にする。具体的には、ストリーム処理部212は、ストリームIDを再利用して、コネクション上のすでに確立されたストリームを通信装置30との通信が可能な状態に設定する。再利用要否判断部213は、ストリームIDの再利用が必要であるか否か(再利用するか否か)を判断する。
図3に示す各要素の機能は、図2で示したCPU21が所定のプログラムを読み出して実行することにより、実現される。ただし、図3に示す各要素のうち、少なくとも一部の機能が専用のハードウェアによって実現されるようにしてもよい。その場合、当該専用のハードウェアは、CPU21の制御に基づいて動作する。
The stream ID management unit 211 manages stream IDs. The stream ID management unit 211 provides a usable stream ID to the frame creation unit 204 when the frame creation unit 204 establishes (starts) a new stream. The stream processing unit 212 performs a process of changing the stream state to a state such as idle, open, or closed. Further, the stream processing unit 212 sets a stream in which the stream ID is reused as a stream process in which the stream ID is reused. Specifically, the stream processing unit 212 reuses the stream ID and sets an already established stream on the connection in a state where communication with the communication device 30 is possible. The reuse necessity determination unit 213 determines whether or not the stream ID needs to be reused (whether or not to reuse).
The function of each element shown in FIG. 3 is realized by the CPU 21 shown in FIG. 2 reading and executing a predetermined program. However, at least some of the elements shown in FIG. 3 may be realized by dedicated hardware. In that case, the dedicated hardware operates based on the control of the CPU 21.

(通信装置30の構成)
図5は、ストリームIDの再利用要求を受信する側である通信装置30のモジュール構成を示す図である。通信装置30は、通信制御部301と、表示制御部302と、接続確立部303と、フレーム作成部304と、フレーム受信部305と、フレーム解析部306と、フレーム送信部307と、を備える。さらに、通信装置30は、応答作成部308と、要求解析部309と、ストリームID管理部311と、ストリーム処理部312と、要求判断部313と、を備える。これらの各モジュール301〜313は、バス300によって接続されている。
(Configuration of communication device 30)
FIG. 5 is a diagram illustrating a module configuration of the communication apparatus 30 that receives the stream ID reuse request. The communication device 30 includes a communication control unit 301, a display control unit 302, a connection establishment unit 303, a frame creation unit 304, a frame reception unit 305, a frame analysis unit 306, and a frame transmission unit 307. Furthermore, the communication device 30 includes a response creation unit 308, a request analysis unit 309, a stream ID management unit 311, a stream processing unit 312, and a request determination unit 313. These modules 301 to 313 are connected by a bus 300.

モジュール301〜307は、図3に示す通信装置20を構成するモジュール201〜207と同様の構成を有する。応答作成部308は、通信装置20から送信されたストリームIDの再利用要求への応答を作成する。要求解析部309は、ストリームIDの再利用要求を解析する。ストリームID管理部311は、図3のストリームID管理部211と同様の構成を有する。ストリーム処理部312は、ストリームの状態を、idle、open、closedなどの状態に遷移させる処理を行う。また、ストリーム処理部312は、ストリームIDを再利用したストリームの処理として、ストリームIDを再利用したストリームを介してデータ(フレーム)の受信を可能な状態とする。要求判断部313は、フレーム受信部304が通信装置20から受信したフレームが、ストリームIDの再利用要求を表すPINGフレームであるか否かを判断する。   The modules 301 to 307 have the same configuration as the modules 201 to 207 constituting the communication device 20 shown in FIG. The response creation unit 308 creates a response to the stream ID reuse request transmitted from the communication device 20. The request analysis unit 309 analyzes a stream ID reuse request. The stream ID management unit 311 has the same configuration as the stream ID management unit 211 of FIG. The stream processing unit 312 performs processing for transitioning the stream state to a state such as idle, open, or closed. In addition, the stream processing unit 312 sets a state in which data (frame) can be received through a stream in which the stream ID is reused, as processing of the stream in which the stream ID is reused. The request determination unit 313 determines whether or not the frame received by the frame reception unit 304 from the communication device 20 is a PING frame representing a stream ID reuse request.

(通信装置20の動作)
次に、ストリームIDの再利用を要求する側である通信装置20の動作について、図6を参照しながら詳細に説明する。通信装置20は、CPU21が所定のプログラムを読み出して実行することにより、図3で示す各要素の処理、及び、図6で示す各処理を実現する。ただし、図3で示す各要素のうち少なくとも一部が専用のハードウェアとして動作するようにしても良い。この場合、当該専用のハードウェアは、CPU21の制御に基づいて動作する。 先ずS1において、接続確立部203は、通信装置20と通信装置30との間のHTTP/2によるコネクションを確立する。コネクションの確立には、プロトコルアップグレードや、コネクションプリフェイスの送受信が含まれる。次にS2において、フレーム作成部204は、HEADERSフレームを作成し、通信装置30へ送信する。HTTP/2では、HEADERSフレームを送信することで、新しいストリームを確立する(ストリームをopen状態にする)。このS2においては、フレーム作成部204は、新しいストリームを確立するために、ストリームID管理部211からストリームIDを1個取得し、HEADERSフレームを作成する。なお、図6に示す例では、HEADERSフレームを例として挙げているが、これに限らず、PUSH_PROMISEフレームのように、新しいストリームIDを必要とするフレームを作成する場合にも、同様の処理を行う。
(Operation of the communication device 20)
Next, the operation of the communication device 20 that requests the reuse of the stream ID will be described in detail with reference to FIG. The communication device 20 implements the processing of each element shown in FIG. 3 and the processing shown in FIG. 6 by the CPU 21 reading and executing a predetermined program. However, at least some of the elements shown in FIG. 3 may operate as dedicated hardware. In this case, the dedicated hardware operates based on the control of the CPU 21. First, in S <b> 1, the connection establishment unit 203 establishes a connection by HTTP / 2 between the communication device 20 and the communication device 30. Establishing a connection includes protocol upgrade and connection pre-face transmission / reception. Next, in S <b> 2, the frame creation unit 204 creates a HEADERS frame and transmits it to the communication device 30. In HTTP / 2, a new stream is established by transmitting a HEADERS frame (the stream is set to the open state). In S2, the frame creation unit 204 acquires one stream ID from the stream ID management unit 211 and creates a HEADERS frame in order to establish a new stream. In the example shown in FIG. 6, the HEADERS frame is taken as an example. However, the present invention is not limited to this, and the same processing is performed when a frame that requires a new stream ID is created, such as a PUSH_PROMISE frame. .

S3では、再利用要否判断部213は、ストリームIDの再利用が必要か否かを判断する。このように、新しいストリームIDを必要とするフレームを作成し送信した直後に、ストリームIDの再利用が必要か否かを判断する。そして、再利用要否判断部213は、ストリームIDの再利用が必要であると判断すると、S2において作成したHEADERSフレームを通信装置30に送信してからS4に移行する。一方、再利用要否判断部213が、ストリームIDの再利用は必要ないと判断した場合には、S2において作成したHEADERSフレームを通信装置30に送信してからS2に戻る。   In S3, the reuse necessity determination unit 213 determines whether or not the stream ID needs to be reused. In this way, immediately after creating and transmitting a frame that requires a new stream ID, it is determined whether or not it is necessary to reuse the stream ID. If the reuse necessity determination unit 213 determines that the stream ID needs to be reused, it transmits the HEADERS frame created in S2 to the communication device 30 and then proceeds to S4. On the other hand, if the reuse necessity determination unit 213 determines that the stream ID does not need to be reused, the HEADERS frame created in S2 is transmitted to the communication device 30 and then the process returns to S2.

ストリームIDの再利用が必要か否かを判断する方法としては、S2において使用したストリームIDが、使用可能であるストリームIDの最大値か否かを確認する方法を用いることができる。HTTP/2に従った通信を行う場合、通信装置は、新しく確立するストリームのストリームIDを、過去に確立したストリームのストリームIDよりも大きい値としなければならない。また、ストリームIDは、31ビットの符号無し整数で管理されているため、21億4748万3647(231−1)までの値となる。さらに、HTTP/2サーバとHTTP/2クライアントとでは、ストリームを確立するときに使用できるストリームIDの値が異なる。クライアントがストリームを確立する場合は奇数、サーバがストリームを確立する場合は偶数のストリームIDを使用可能である。 As a method of determining whether or not the stream ID needs to be reused, a method of confirming whether or not the stream ID used in S2 is the maximum value of the stream ID that can be used can be used. When performing communication according to HTTP / 2, the communication apparatus must set the stream ID of a newly established stream to a value larger than the stream ID of a stream established in the past. Also, since the stream ID is managed as a 31-bit unsigned integer, the value is up to 2,147,483,647 (2 31 -1). Furthermore, the value of the stream ID that can be used when establishing a stream is different between the HTTP / 2 server and the HTTP / 2 client. An odd stream ID can be used when the client establishes a stream, and an even stream ID when the server establishes a stream.

したがって、クライアントが使用可能であるストリームIDの最大値は、21億4748万3647(231−1)となり、サーバが使用可能であるストリームIDの最大値は、21億4748万3646(231−2)となる。再利用要否判断部213は、S2において使用したストリームIDと、使用可能であるストリームIDの最大値(231−1)とを比較することで、ストリームIDの再利用が必要かを判断する。
なお、ストリームIDの再利用の要否を判断する方法は、ストリームIDの最大値を使用する方法に限定されない。再利用要否判断部213は、上記の最大値よりも小さい所定の閾値(例えば、231−100)を設定し、新たに確立したストリームのストリームIDの値が上記の所定の閾値を超えた場合に、ストリームIDの再利用が必要であると判断してもよい。なお、上記所定の閾値は、事前に通信装置30と通信を行って決定してもよいし、通信装置20内部に値を保持していてもよい。また、再利用要否判断部213は、コネクションの確立からある一定時間(例えば、1年間)が経過した場合に、ストリームIDの再利用が必要と判断してもよい。
Therefore, the maximum value of the stream ID client is available, 2.1 billion 47,483,647 (2 31 -1), and the maximum value of the stream ID server is available, the 2.1 billion 47,483,646 (2 31 - 2). The reuse necessity determination unit 213 determines whether the stream ID needs to be reused by comparing the stream ID used in S2 with the maximum value (2 31 -1) of the available stream ID. .
The method for determining whether or not the stream ID needs to be reused is not limited to the method using the maximum value of the stream ID. The reuse necessity determination unit 213 sets a predetermined threshold value (eg, 2 31 -100) smaller than the maximum value, and the stream ID value of the newly established stream exceeds the predetermined threshold value. In this case, it may be determined that the stream ID needs to be reused. The predetermined threshold value may be determined by communicating with the communication device 30 in advance, or a value may be held in the communication device 20. Further, the reuse necessity determination unit 213 may determine that the stream ID needs to be reused when a certain time (for example, one year) has elapsed since the connection was established.

S4では、フレーム作成部204は、ストリームIDの再利用要求を表すPINGフレームを作成する。PINGフレームは、図4で示すように、フレームヘッダ51とフレームペイロード52とから構成され、フレームペイロード52は、8オクテットのデータ(Opaque Data)を含む。
図6に戻って、S5では、再利用要求作成部208は、S4において作成したPINGフレームのフレームヘッダ51の各フィールドに値を書き込む。このS5において、再利用要求作成部208は、フレームヘッダ51のFlagsフィールドに、ストリームの再利用を要求するオプションを表すフラグ(再利用要求フラグ)を書き込む。
In S4, the frame creation unit 204 creates a PING frame representing a stream ID reuse request. As shown in FIG. 4, the PING frame includes a frame header 51 and a frame payload 52. The frame payload 52 includes 8-octet data (Opaque Data).
Returning to FIG. 6, in S5, the reuse request creation unit 208 writes a value in each field of the frame header 51 of the PING frame created in S4. In S <b> 5, the reuse request creation unit 208 writes a flag (reuse request flag) indicating an option for requesting stream reuse in the Flags field of the frame header 51.

図7は、ストリームIDの再利用要求を表すPINGフレームの一例である。図7に示すように、Lengthフィールドには、フレームのペイロードの長さを書き込む。PINGフレームの場合、Lengthフィールドには0x8を書き込む。Typeフィールドには、フレームの種類が書き込まれる。PINGフレームの場合、Typeフィールドには0x6を書き込む。Flagフィールドには、フレームに設定するフラグが書き込まれる。本実施形態では、このFlagフィールドに、ストリームIDの再利用要求を表すオプション(再利用要求フラグ)として、0x2を書き込む。Rフィールドは、1ビットの予約ビットである。Rフィールドには、0x0を書き込む。Stream Identifierフィールドには、ストリームIDが書き込まれる。PINGフレームの場合、Stream Identifierフィールドには、0x0を書き込む。
なお、図7に示す例では、再利用要求フラグを0x2としているが、これに限定されるものではなく、再利用要求フラグの値は通信装置間で適宜設定可能である。
FIG. 7 is an example of a PING frame representing a stream ID reuse request. As shown in FIG. 7, the length of the payload of the frame is written in the Length field. In the case of a PING frame, 0x8 is written in the Length field. The type of frame is written in the Type field. In the case of a PING frame, 0x6 is written in the Type field. A flag to be set for the frame is written in the Flag field. In the present embodiment, 0x2 is written in this Flag field as an option (reuse request flag) indicating a stream ID reuse request. The R field is a 1-bit reserved bit. In the R field, 0x0 is written. The stream ID is written in the Stream Identifier field. In the case of a PING frame, 0x0 is written in the Stream Identifier field.
In the example shown in FIG. 7, the reuse request flag is set to 0x2. However, the present invention is not limited to this, and the value of the reuse request flag can be set as appropriate between communication apparatuses.

また、PINGフレームは、上述したように、8オクテットのOpaque Dataをフレームペイロード52として使用することができる。そこで、本実施形態では、このOpaque Data領域を使用して、再利用を要求するストリームIDを書き込む。ストリームの状態がclosedである場合、そのストリーム上でデータ(フレーム)を送信することはできない。したがって、通信装置20は、ストリームの状態がclosedであるストリームのストリームIDの再利用を要求する。なお、ストリームの状態がidle状態であるストリームのストリームIDを再利用要求してもよい。   As described above, the PING frame can use 8-octet Opaque Data as the frame payload 52. Therefore, in the present embodiment, a stream ID for requesting reuse is written using this Opaque Data area. When the state of the stream is closed, data (frame) cannot be transmitted on the stream. Therefore, the communication device 20 requests reuse of the stream ID of a stream whose stream state is closed. Note that a stream ID of a stream whose stream state is the idle state may be requested to be reused.

図6のS6では、再利用要求作成部208は、図7に示すように、Opaque Data領域(フレームペイロード52)の最初の4オクテットに、再利用を開始するストリームIDを書き込む。図7に示す例では、Stream IDフィールドに0x3を書き込むことで、ストリームIDの再利用を3から始めるように要求している。つまり、再利用要求作成部208は、再利用を要求するストリームIDの区間の最小値を、通信装置30へ送信する。なお、本実施形態では、フレームヘッダ51のFlagsフィールドと、Opqaue Data領域とを利用してストリームIDの再利用要求を行っているが、Flagsフィールドだけを利用して、ストリームIDの再利用要求を行ってもよい。   In S6 of FIG. 6, the reuse request creation unit 208 writes the stream ID for starting reuse in the first 4 octets of the Opaque Data area (frame payload 52), as shown in FIG. In the example illustrated in FIG. 7, the stream ID reuse is requested to start from 3 by writing 0x3 in the Stream ID field. That is, the reuse request creation unit 208 transmits to the communication device 30 the minimum value of the stream ID section for which reuse is requested. In this embodiment, a stream ID reuse request is made using the Flags field of the frame header 51 and the Opqueue Data area, but a stream ID reuse request is made using only the Flags field. You may go.

図6のS7では、フレーム送信部207は、S4〜S6において作成したPINGフレームを通信装置30に送信する。次に、S8では、フレーム受信部205は、送信したPINGフレームに対する応答を受信する。S9では、応答解析部209は、S8において受信した応答のフレームヘッダ51を解析する。本実施形態では、通信装置30がストリームIDの再利用に対応している場合、図8に示すように、PINGフレームの応答のFlagフィールドに、ストリームIDの再利用に対応していることを示す値(0x5)が書き込まれる。なお、通信装置30がストリームIDの再利用に対応している状態とは、通信装置30がストリームIDの再利用を許可している状態のことをいう。また、ストリームIDの再利用に対応していることを示す値は、0x5に限定されるものではなく、通信装置間で適宜設定可能である。   In S <b> 7 of FIG. 6, the frame transmission unit 207 transmits the PING frame created in S <b> 4 to S <b> 6 to the communication device 30. Next, in S8, the frame receiving unit 205 receives a response to the transmitted PING frame. In S9, the response analysis unit 209 analyzes the frame header 51 of the response received in S8. In the present embodiment, when the communication apparatus 30 supports the reuse of stream IDs, as shown in FIG. 8, the Flag field of the PING frame response indicates that the stream IDs are supported for reuse. A value (0x5) is written. Note that the state in which the communication device 30 supports the reuse of the stream ID refers to a state in which the communication device 30 permits the reuse of the stream ID. Also, the value indicating that the stream ID is reused is not limited to 0x5, and can be set as appropriate between communication apparatuses.

S9では、応答解析部209は、S8において受信したPINGフレームのフレームヘッダ51におけるFlagsフィールドの値を解析する。次にS10では、再利用可否判断部210は、S9における解析結果をもとに、通信装置30がストリームIDの再利用に対応しているか否かを判断する。PINGフレームのFlagフィールドに0x5が書き込まれていた場合、再利用可否判断部210は、通信装置20がストリームIDの再利用に対応していると判断し、S11に移行する。一方、PINGフレームのFlagフィールドに0x5と異なる値が書き込まれていた場合には、再利用可否判断部210は、通信装置30がストリームIDの再利用には対応していないと判断してS13に移行する。   In S9, the response analysis unit 209 analyzes the value of the Flags field in the frame header 51 of the PING frame received in S8. Next, in S10, the reusability determination unit 210 determines whether the communication device 30 supports the reuse of the stream ID based on the analysis result in S9. When 0x5 is written in the Flag field of the PING frame, the reusability determination unit 210 determines that the communication apparatus 20 supports the reuse of the stream ID, and proceeds to S11. On the other hand, when a value different from 0x5 is written in the Flag field of the PING frame, the reusability determination unit 210 determines that the communication device 30 does not support the reuse of the stream ID, and proceeds to S13. Transition.

S11では、応答解析部209は、PINGフレームの応答のOpaque Data領域を解析する。本実施形態では、通信装置30がストリームIDの再利用に対応している場合、Opaque Data領域の最初の4オクテットには、通信装置30が再利用を受け付ける先頭のストリームIDが書き込まれる。図8は、通信装置30がストリームID=3を、再利用を受け付ける先頭のストリームIDとして指定した例である。S11では、応答解析部209は、Opaque Data領域を解析し、再利用を行うストリームIDを確認する。   In S11, the response analysis unit 209 analyzes the Opaque Data area of the response of the PING frame. In the present embodiment, when the communication device 30 supports the reuse of stream IDs, the first stream ID for which the communication device 30 accepts reuse is written in the first four octets of the Opaque Data area. FIG. 8 shows an example in which the communication device 30 designates stream ID = 3 as the first stream ID for accepting reuse. In S11, the response analysis unit 209 analyzes the Opaque Data area and confirms the stream ID to be reused.

次にS12では、フレーム作成部204は、ストリームID管理部211に対してS11において確認した、再利用するストリームIDを要求する。すると、ストリームID管理部211は、フレーム作成部204に対して、再利用するストリームIDを提供する。また、ストリーム処理部212は、ストリームIDを再利用したストリームを確立可能な状態にする。
また、S13では、ストリームIDの再利用要求が許可されなかったとして、エラー処理を行う。エラー処理としては、再利用要求を再度送信してもよいし、接続中のコネクションを切断して新たなコネクションを接続してもよい。
Next, in S12, the frame creation unit 204 requests the stream ID management unit 211 for the stream ID to be reused confirmed in S11. Then, the stream ID management unit 211 provides the stream ID to be reused to the frame creation unit 204. In addition, the stream processing unit 212 sets a stream in which the stream ID is reused to be established.
In S13, an error process is performed on the assumption that the stream ID reuse request is not permitted. As error processing, a reuse request may be transmitted again, or a connection that is currently connected may be disconnected and a new connection may be connected.

このように、通信装置20は、自装置が使用するストリームIDをもとに、ストリームIDを再利用するか否かを判断し、再利用すると判断した場合、通信相手の通信装置30に対して、ストリームIDの再利用を要求する。また、通信装置20は、ストリームIDを再利用すると判断した場合、コネクション上のすでに確立されたストリームを通信装置30との通信が可能な状態に設定することで、ストリームIDを再利用したストリームを確立する。
本実施形態では、通信装置20は、ストリームIDの再利用が必要であると判断し、ストリームIDの再利用の要求を送信すると、その要求に対する通信装置30からの応答を待つ。そして、通信装置20は、通信相手の通信装置30からストリームIDの再利用を許可する応答を受信したとき、ストリームIDを再利用してストリームを確立する。このように、通信装置20は、通信相手の通信装置30がストリームIDの再利用に対応していることを確認してから、再利用したストリームIDを用いてストリームを確立することができる。
As described above, the communication device 20 determines whether or not to reuse the stream ID based on the stream ID used by the own device. , Request the reuse of the stream ID. If the communication device 20 determines that the stream ID is to be reused, it sets the already established stream on the connection to a state in which communication with the communication device 30 is possible. Establish.
In this embodiment, when the communication device 20 determines that the stream ID needs to be reused and transmits a stream ID reuse request, the communication device 20 waits for a response from the communication device 30 to the request. When the communication device 20 receives a response permitting reuse of the stream ID from the communication device 30 of the communication partner, the communication device 20 reuses the stream ID to establish a stream. As described above, the communication device 20 can establish a stream using the reused stream ID after confirming that the communication device 30 of the communication partner supports the reuse of the stream ID.

また、通信装置20は、通信装置30からのストリームIDの再利用の要求に対する応答として、再利用を許可するストリームIDの情報を受信したとき、再利用を許可されたストリームIDを再利用してストリームを確立する。したがって、確実に再利用が可能なストリームIDを用いてストリームを確立することができる。
また、通信装置20は、すでに開始または予約したストリームIDが、使用可能な最大値に到達したとき、ストリームを使い切ったとして、ストリームIDの再利用が必要であると判断する。これにより、適切にストリームIDの再利用が必要な状態を検出し、ストリームIDを再利用することができる。
さらに、通信装置20は、通信装置30へストリームIDの再利用の要求を送信する際、再利用を要求するストリームIDの区間の最小値を送信する。このように、通信装置20は、再利用を要求するストリームIDの情報を通信装置30へ送信する。このとき、通信装置20は、フレームを送ることができない状態であるストリームのストリームIDについて、再利用を要求する。これにより、ストリームの再利用を適切に行うことができる。
In addition, when the communication device 20 receives information on the stream ID that permits reuse as a response to the request for reuse of the stream ID from the communication device 30, the communication device 20 reuses the stream ID that is permitted to be reused. Establish a stream. Therefore, a stream can be established using a stream ID that can be reliably reused.
In addition, when the already started or reserved stream ID reaches the maximum usable value, the communication device 20 determines that the stream ID needs to be reused, assuming that the stream has been used up. Accordingly, it is possible to detect a state where the stream ID needs to be reused appropriately and reuse the stream ID.
Furthermore, when the communication device 20 transmits a stream ID reuse request to the communication device 30, the communication device 20 transmits the minimum value of the stream ID section requesting reuse. In this way, the communication device 20 transmits information on the stream ID requesting reuse to the communication device 30. At this time, the communication device 20 requests reuse of the stream ID of the stream in a state where the frame cannot be sent. Thereby, the reuse of the stream can be appropriately performed.

(通信装置30の動作)
次に、ストリームIDの再利用要求を受信する側である通信装置30の動作について、図9を参照しながら説明する。通信装置30は、CPU21が所定のプログラムを読み出して実行することにより、図5で示す各要素の処理、及び、図9で示す各処理を実現する。ただし、図5で示す各要素のうち少なくとも一部が専用のハードウェアとして動作するようにしても良い。この場合、当該専用のハードウェアは、CPU21の制御に基づいて動作する。
(Operation of communication device 30)
Next, the operation of the communication device 30 that receives the stream ID reuse request will be described with reference to FIG. The communication device 30 implements the processing of each element shown in FIG. 5 and the processing shown in FIG. 9 by the CPU 21 reading and executing a predetermined program. However, at least some of the elements shown in FIG. 5 may operate as dedicated hardware. In this case, the dedicated hardware operates based on the control of the CPU 21.

先ずS21において、接続確立部303は、通信装置30と通信装置20との間のHTTP/2によるコネクションを確立する。コネクションの確立には、プロトコルアップグレードや、コネクションプリフェイスの送受信が含まれる。次にS22において、フレーム解析部306は、フレーム受信部305が通信装置20から受信したフレームが、PINGフレームであるか否かを判定する。そして、PINGフレームを受信していない場合はS22の判定を繰り返し、PINGフレームを受信するとS23に移行する。S23では、要求解析部309は、S22において受信したPINGフレームのフレームヘッダ51のFlagフィールドを解析する。   First, in S <b> 21, the connection establishment unit 303 establishes a connection by HTTP / 2 between the communication device 30 and the communication device 20. Establishing a connection includes protocol upgrade and connection pre-face transmission / reception. In step S22, the frame analysis unit 306 determines whether the frame received by the frame reception unit 305 from the communication device 20 is a PING frame. If the PING frame has not been received, the determination in S22 is repeated, and if a PING frame is received, the process proceeds to S23. In S23, the request analysis unit 309 analyzes the Flag field of the frame header 51 of the PING frame received in S22.

上述したように、通信装置20が送信したPINGフレームがストリームIDの再利用要求である場合、図7に示すように、Flagフィールドには再利用要求フラグとして0x2が書き込まれている。そこで、S24では、要求判断部313は、PINGフレームに再利用要求フラグが記述されているか否かを判定し、再利用要求フラグが記述されている場合には、受信したPINGフレームがストリームIDの再利用要求であると判断し、S25に移行する。一方、PINGフレームに再利用要求フラグが記述されていない場合には、S24において、要求判断部313は、受信したPINGフレームはストリームIDの再利用要求ではないと判断し、S22に戻る。   As described above, when the PING frame transmitted by the communication device 20 is a stream ID reuse request, 0x2 is written in the Flag field as a reuse request flag as shown in FIG. Therefore, in S24, the request determination unit 313 determines whether or not a reuse request flag is described in the PING frame. If the reuse request flag is described, the received PING frame includes the stream ID. It is determined that the request is a reuse request, and the process proceeds to S25. On the other hand, if the reuse request flag is not described in the PING frame, in S24, the request determination unit 313 determines that the received PING frame is not a stream ID reuse request, and the process returns to S22.

S25では、要求解析部309は、PINGフレームのOpaque Data領域を解析する。上述したように、PINGフレームがストリームIDの再利用要求である場合、Opaque Data領域には再利用を開始するストリームIDが書き込まれている。そこで、S25では、要求解析部309は、Opaque Data領域から、再利用を開始するストリームIDを確認する。
次にS26では、フレーム作成部304は、PINGフレームへの応答を作成する。S27では、応答作成部308は、S26において作成したPINGフレームのフレームヘッダ51におけるFlagフィールドに、再利用要求への応答を書き込む。本実施形態では、ストリームIDの再利用要求を許可する場合、再利用要求への応答として、図8に示すように、Flagフィールドに0x5を書き込む。一方、ストリームIDの再利用要求を許可しない場合には、再利用要求への応答として、Flagフィールドに0x5以外の値を書き込む。
In S25, the request analysis unit 309 analyzes the Opaque Data area of the PING frame. As described above, when the PING frame is a stream ID reuse request, a stream ID for starting reuse is written in the Opaque Data area. Therefore, in S25, the request analysis unit 309 confirms the stream ID for starting reuse from the Opaque Data area.
Next, in S26, the frame creation unit 304 creates a response to the PING frame. In S27, the response creation unit 308 writes a response to the reuse request in the Flag field in the frame header 51 of the PING frame created in S26. In this embodiment, when a stream ID reuse request is permitted, 0x5 is written in the Flag field as a response to the reuse request, as shown in FIG. On the other hand, when the stream ID reuse request is not permitted, a value other than 0x5 is written in the Flag field as a response to the reuse request.

次にS28では、応答作成部308は、PINGフレームのOpaque Data領域に、ストリームIDの再利用を許可する先頭の値を書き込む。このS28では、応答作成部308は、closed状態であるストリームのストリームIDを、再利用が可能であるストリームIDとしてOpaque Data領域に書き込む。通信装置30は、ストリームの状態がclosedであるストリームのストリームIDを再利用可能であるとする。なお、ストリームの状態がidle状態であるストリームのストリームIDを再利用可能であるとしてもよい。   Next, in S28, the response creation unit 308 writes the leading value that permits the reuse of the stream ID in the Opaque Data area of the PING frame. In S28, the response creation unit 308 writes the stream ID of the stream in the closed state in the Opaque Data area as a stream ID that can be reused. It is assumed that the communication device 30 can reuse the stream ID of a stream whose stream state is closed. Note that the stream ID of a stream whose stream state is the idle state may be reusable.

図8に示す例では、使用を許可するストリームIDの先頭の値として0x3を書き込んでいる。使用を許可するストリームIDは、通信装置20が再利用を要求しているストリームIDを優先して決定する。ところで、通信装置20が0x3を再利用するストリームIDとして要求してきた場合、0x3をストリームIDとして使用したストリームの確立は許可できないが、0x5以上の値をストリームIDとして使用したストリームの確立は許可できる場合がある。そのような場合には、応答作成部308は、PINGフレームのOpaque Data領域に、使用を許可するストリームIDの先頭の値として0x5を書き込んでもよい。   In the example shown in FIG. 8, 0x3 is written as the first value of the stream ID that is permitted to be used. The stream ID that is permitted to be used is determined with priority given to the stream ID that the communication device 20 requests to reuse. By the way, when the communication device 20 requests 0x3 as a stream ID to be reused, establishment of a stream using 0x3 as a stream ID cannot be permitted, but establishment of a stream using a value of 0x5 or more as a stream ID can be permitted. There is a case. In such a case, the response creation unit 308 may write 0x5 as the first value of the stream ID permitted to be used in the Opaque Data area of the PING frame.

なお、ストリーム処理部312がストリームを閉じる処理を行っているときに、通信装置20がストリームIDを再利用してストリームを開こうとしてくる場合がある。この場合には、待機通知を送信することで該当ストリームのストリームIDを利用できないことを通知し、該当ストリームを閉じてから該当ストリームの確立を許可する応答をしてもよい。また、該当ストリームの確立を許可しない応答をしてもよい。
S29では、フレーム送信部307は、S26〜S28において作成したPINGフレームを通信装置20へ送信する。次にS30では、ストリーム処理部312は、再利用したストリーム上でのフレームの受信を開始する。
Note that when the stream processing unit 312 performs the process of closing the stream, the communication device 20 may try to open the stream by reusing the stream ID. In this case, it may be notified that the stream ID of the corresponding stream cannot be used by transmitting a standby notification, and a response permitting establishment of the corresponding stream may be sent after closing the corresponding stream. Further, a response that does not permit establishment of the corresponding stream may be made.
In S29, the frame transmission unit 307 transmits the PING frame created in S26 to S28 to the communication device 20. Next, in S30, the stream processing unit 312 starts receiving frames on the reused stream.

このように、通信装置30は、通信相手の通信装置20からストリームIDを再利用する要求を受信したとき、再利用を許可するか否かを判断する。そして、通信装置30は、ストリームIDの再利用を許可すると判断したとき、ストリームIDを再利用したストリームを受信する。
本実施形態では、通信装置30は、ストリームIDの再利用を許可するか否かを判断した後、その判断結果をストリームIDの再利用要求への応答として、通信装置20へ返送する。これにより、通信装置20は、通信装置30がストリームIDの再利用に対応しているか否かを把握することができる。
また、通信装置30は、通信装置20からのストリームIDの再利用要求に対する応答として、自装置が受信可能なストリームIDを送信する。また、通信装置20が再利用を要求しているストリームIDが受信可能な場合には、通信装置30は、通信装置20が再利用を要求しているストリームIDを優先して再利用を許可するようにする。これにより、再利用したストリームIDを用いたストリームの処理を適切に行うことができる。
As described above, when receiving a request for reusing the stream ID from the communication device 20 of the communication partner, the communication device 30 determines whether or not to permit the reuse. When the communication device 30 determines that the reuse of the stream ID is permitted, the communication device 30 receives the stream in which the stream ID is reused.
In the present embodiment, the communication device 30 determines whether or not the reuse of the stream ID is permitted, and then returns the determination result to the communication device 20 as a response to the stream ID reuse request. Thereby, the communication apparatus 20 can grasp | ascertain whether the communication apparatus 30 respond | corresponds to reuse of stream ID.
Further, the communication device 30 transmits a stream ID that can be received by the communication device 30 as a response to the stream ID reuse request from the communication device 20. When the stream ID requested to be reused by the communication device 20 can be received, the communication device 30 gives priority to the reuse of the stream ID requested by the communication device 20 to be reused. Like that. Thereby, the process of the stream using the reused stream ID can be appropriately performed.

なお、本実施形態では、通信装置20の再利用要否判断部213は、HEADERSフレームなどの新しいストリームIDを必要とするフレームを作成し、送信した後にストリームIDの再利用が必要かを判断している。しかしながら、ストリームIDの再利用の要否を判断するタイミングは、新しいストリームIDを必要とするフレームを送信した後に限定されない。例えば、新しいストリームIDを必要とするフレームを作成する前に判断してもよいし、新しいストリームIDを必要とするフレームを作成した後、そのフレームを送信する前に判断してもよい。
また、本実施形態では、通信装置20の再利用要求作成部208は、PINGフレームを利用してストリームIDの再利用要求を行っている。しかしながら、ストリームIDの再利用を要求する方法はこれに限定されない。例えば、SETTINGSフレームや、拡張フレームを定義して、ストリームIDの再利用を要求してもよい。また、ストリームを閉じるときにフラグを設定して、閉じたストリームのIDが再利用可能であることを通知してもよい。ストリームIDを閉じるときにフラグを設定することで、閉じたストリームのIDをすぐに再利用できるという効果がある。
In this embodiment, the reuse necessity determination unit 213 of the communication device 20 creates a frame that requires a new stream ID, such as a HEADERS frame, and determines whether the stream ID needs to be reused after transmission. ing. However, the timing for determining whether or not it is necessary to reuse the stream ID is not limited after transmitting a frame that requires a new stream ID. For example, it may be determined before creating a frame that requires a new stream ID, or after creating a frame that requires a new stream ID and before transmitting that frame.
In the present embodiment, the reuse request creation unit 208 of the communication device 20 makes a stream ID reuse request using the PING frame. However, the method for requesting reuse of the stream ID is not limited to this. For example, a SETTINGS frame or an extension frame may be defined to request reuse of the stream ID. Alternatively, a flag may be set when the stream is closed to notify that the ID of the closed stream can be reused. By setting a flag when closing the stream ID, there is an effect that the ID of the closed stream can be reused immediately.

さらに、本実施形態では、通信装置30は、通信装置20からのストリームIDの再利用要求の応答として、通信装置20へストリームIDの再利用に対応しているか否かを通知している。しかしながら、通信装置30は、ストリームIDの再利用に対応しているか否かを、事前に通信装置20へ通知してもよい。通信装置20に対してストリームIDの再利用に対応していることを通知する方法として、PINGフレームやSETTTINGSフレームを利用する方法が考えられる。また、その他にも独自のフレームを使用する方法が考えられるが、これらに限定されない。事前に通知をするタイミングは、HTTP/2通信の開始時とすることができるが、これに限定されない。
通信装置20において、通信装置30がストリームIDの再利用に対応していることを事前に確認できる場合には、通信装置20は、ストリームIDの再利用要求を行った後、通信装置30からの応答を待たずにストリームIDの再利用を開始することができる。その結果、新しいストリームを確立するまでの期間を短縮することができる。
Further, in the present embodiment, the communication device 30 notifies the communication device 20 as to whether or not the stream ID reuse is supported as a response to the stream ID reuse request from the communication device 20. However, the communication device 30 may notify the communication device 20 in advance whether or not the reuse of the stream ID is supported. As a method for notifying the communication device 20 that the stream ID can be reused, a method using a PING frame or a SETTINGS frame can be considered. In addition, other methods using original frames are conceivable, but the present invention is not limited to these methods. The notification timing in advance can be set at the start of HTTP / 2 communication, but is not limited thereto.
In the communication device 20, when it can be confirmed in advance that the communication device 30 supports the reuse of the stream ID, the communication device 20 sends a request for reuse of the stream ID, and then receives a request from the communication device 30. The reuse of the stream ID can be started without waiting for a response. As a result, it is possible to shorten the period until a new stream is established.

さらに、上記のように通信装置20が、ストリームIDの再利用要求の送信後、ストリームIDの再利用要求への応答を待たずにストリームIDの再利用を開始する場合、通信装置30は以下の処理が可能である。つまり、通信装置30は、再利用要求がされたストリームが使用されていない状態であれば、そのストリームを受信してもよいし、ストリームIDの再利用を許可する応答を送信してから、そのストリームを受信してもよい。なお、ストリームが使用されていない状態として、closed状態が考えられるが、これに限定されない。   Furthermore, when the communication apparatus 20 starts reusing the stream ID without waiting for a response to the stream ID reuse request after transmitting the stream ID reuse request as described above, the communication apparatus 30 may Processing is possible. In other words, the communication device 30 may receive the stream if the stream requested to be reused is not used, or after transmitting a response permitting the reuse of the stream ID, A stream may be received. In addition, although the closed state can be considered as a state where the stream is not used, it is not limited to this.

また、本実施形態では、通信装置20がストリームIDの再利用を要求するとき、ストリームIDの再利用を開始する先頭のストリームIDを要求しているが、これに限定されない。例えば、再利用を要求するストリームID1つを要求してもよいし、ストリームIDを再利用する区間の最小値と最大値とを要求してもよい。さらに、再利用を要求する複数のストリームIDをリストで送信してもよい。
また、本実施形態では、通信装置30がストリームIDの再利用を許可するとき、ストリームIDの再利用の開始を許可する先頭のストリームIDを送信しているが、これに限定されない。例えば、再利用を要求するストリームID1つを通知してもよいし、ストリームIDの再利用を許可する区間の最小値と最大値とを通知してもよい。さらに、再利用を許可する複数のストリームIDをリストで通知してもよい。また、再利用を許可しないストリームIDを通知してもよい。
In the present embodiment, when the communication device 20 requests the reuse of the stream ID, the first stream ID for starting the reuse of the stream ID is requested, but the present invention is not limited to this. For example, one stream ID requesting reuse may be requested, or a minimum value and a maximum value of a section in which stream ID is reused may be requested. Furthermore, a plurality of stream IDs requesting reuse may be transmitted in a list.
In this embodiment, when the communication device 30 permits the reuse of the stream ID, the first stream ID that permits the start of the reuse of the stream ID is transmitted. However, the present invention is not limited to this. For example, one stream ID requesting reuse may be notified, or the minimum value and the maximum value of a section in which the reuse of the stream ID is permitted may be notified. Further, a plurality of stream IDs permitted to be reused may be notified in a list. Further, a stream ID that is not permitted to be reused may be notified.

図10に示すように、ストリームID=1,3,9がopen状態、ストリームID=5,7,11,13がclosed状態であるときに、通信装置20が新たなストリームを確立するためにストリームIDの再利用が必要である場合を考える。この図10に示す状態では、ストリームID=5,7,11,13の再利用が可能である。そこで、通信装置20がストリームIDの再利用を開始するIDとして5を要求し、通信装置30が要求を許可すると、ストリームID=5から再利用が開始される。しかしながら、この場合、ストリームID=5,7を再利用した後にストリームID=9を再利用しようとするとエラーになってしまう。一方、通信装置20が再利用を開始するストリームIDとして11を要求すると、エラーにはならないが、ストリームID=5,7は再利用できなくなってしまう。   As shown in FIG. 10, when the stream ID = 1, 3, 9 is in the open state and the stream ID = 5, 7, 11, 13 is in the closed state, the communication apparatus 20 establishes a new stream to establish a new stream. Consider the case where ID reuse is required. In the state shown in FIG. 10, stream IDs = 5, 7, 11, and 13 can be reused. Therefore, when the communication device 20 requests 5 as an ID for starting the reuse of the stream ID and the communication device 30 permits the request, the reuse is started from the stream ID = 5. However, in this case, if stream ID = 5 and 7 are reused and stream ID = 9 is attempted to be reused, an error occurs. On the other hand, if the communication apparatus 20 requests 11 as a stream ID for starting reuse, an error does not occur, but stream IDs 5 and 7 cannot be reused.

上記のような場合に、ストリームID1つを要求する方法を用いると、ストリームID=5,7,11,13全てを再利用することができる。また、ストリームIDを再利用する区間の最小値と最大値を要求する方法を用いると、ストリームIDを1つずつ指定する方法よりも、通信装置間のやり取りの回数を削減することができる。
図10に示す状態から、ストリームID=5,7,11,13のストリームの再利用を開始すると、ストリームIDの状態は図11に示すように全てopen状態となる。そして、図11に示す状態から、ストリームID=5,7のストリームの再利用を終えると、ストリームID=5,7の状態は、図12に示すようにclosed状態となる。この場合、通信装置20は、ストリームID=5からストリームID=7までの区間を再利用する要求を送信して、ストリームIDの再利用を繰り返すことができる。なお、図8〜図10ではストリームID=13までを示しているが、ストリームID=15以降についても同様である。
In such a case, if a method for requesting one stream ID is used, all stream IDs = 5, 7, 11, and 13 can be reused. Further, when the method for requesting the minimum value and the maximum value of the section in which the stream ID is reused is used, the number of times of communication between the communication devices can be reduced as compared with the method of designating the stream ID one by one.
When the reuse of the streams with stream IDs = 5, 7, 11, and 13 is started from the state shown in FIG. 10, the state of the stream IDs is all in the open state as shown in FIG. Then, when the reuse of the stream with the stream ID = 5, 7 is finished from the state shown in FIG. 11, the state with the stream ID = 5, 7 becomes the closed state as shown in FIG. In this case, the communication apparatus 20 can repeat the reuse of the stream ID by transmitting a request to reuse the section from the stream ID = 5 to the stream ID = 7. 8 to 10 show the stream ID = 13, the same applies to the stream ID = 15 and later.

さらに、本実施形態では、通信装置20の再利用要否判断部213において、ストリームIDの再利用が必要かどうかを判断しているが、通信装置30が、通信装置20側のストリームIDの再利用が必要かどうかを判断してもよい。この場合、通信装置20は、通信相手の通信装置30から、ストリームIDの再利用が必要であることを示す通知を受信する。この通知を受信したとき、通信装置20は、ストリームIDの再利用が必要であると判断し、通信装置30に対してストリームIDを再利用することを示す応答を送信する。そして、通信装置20は、応答を送信した後、ストリームIDの再利用を開始する。このように、通信装置20と通信装置30の両方により、ストリームIDの再利用が必要であるか否かを判断してもよい。   Furthermore, in the present embodiment, the reuse necessity determination unit 213 of the communication device 20 determines whether or not the stream ID needs to be reused. However, the communication device 30 does not recycle the stream ID on the communication device 20 side. You may decide whether you need to use it. In this case, the communication device 20 receives a notification indicating that the stream ID needs to be reused from the communication device 30 of the communication partner. When receiving this notification, the communication device 20 determines that the stream ID needs to be reused, and transmits a response indicating that the stream ID is reused to the communication device 30. Then, after transmitting the response, the communication device 20 starts reusing the stream ID. In this way, both the communication device 20 and the communication device 30 may determine whether or not the stream ID needs to be reused.

図13は、通信装置20がストリームIDの再利用を要求し、通信装置30が再利用要求に対して応答する場合の、通信装置20と通信装置30との間のメッセージのやり取りを示すシーケンス図である。
先ずS101において、通信装置20と通信装置30との間のHTTP/2によるコネクションが確立される。コネクションの確立には、プロトコルアップグレードや、コネクションプリフェイスの送受信が含まれる。S102では、通信装置20と通信装置30との間で、HTTP/2通信が行われる。本シーケンス図では、通信装置20は、S102において21億4748万3645(231−3)までのストリームIDを使用したこととする。
FIG. 13 is a sequence diagram illustrating message exchange between the communication device 20 and the communication device 30 when the communication device 20 requests the reuse of the stream ID and the communication device 30 responds to the reuse request. It is.
First, in S101, an HTTP / 2 connection between the communication device 20 and the communication device 30 is established. Establishing a connection includes protocol upgrade and connection pre-face transmission / reception. In S102, HTTP / 2 communication is performed between the communication device 20 and the communication device 30. In this sequence diagram, it is assumed that the communication apparatus 20 has used stream IDs up to 2,147,483,645 (2 31 -3) in S102.

次に、通信装置20のフレーム作成部204は、新しいストリームを確立するために、ストリームID管理部211からストリームIDを1個取得し、S103においてHEADERSフレームを作成する(図6のS2)。このS103において取得されるストリームIDは、21億4748万3647(231−1)である。次に、S104では、通信装置20のフレーム送信部207が通信装置30へHEADERSフレームを送信する。また、このとき通信装置30のフレーム受信部305は、通信装置20から送信されたHEADERSフレームを受信する。
HEADERSフレームの作成に使用したストリームIDは、通信装置20において使用可能なストリームIDの最大値である。したがって、S105において、通信装置20の再利用要否判断部213は、ストリームIDの再利用が必要であると判断する(図6のS3)。
Next, in order to establish a new stream, the frame creation unit 204 of the communication apparatus 20 acquires one stream ID from the stream ID management unit 211, and creates a HEADERS frame in S103 (S2 in FIG. 6). The stream ID acquired in S103 is 2,147,483,647 (2 31 -1). Next, in S <b> 104, the frame transmission unit 207 of the communication device 20 transmits a HEADERS frame to the communication device 30. At this time, the frame reception unit 305 of the communication device 30 receives the HEADERS frame transmitted from the communication device 20.
The stream ID used for creating the HEADERS frame is the maximum value of the stream ID that can be used in the communication device 20. Therefore, in S105, the reuse necessity determination unit 213 of the communication device 20 determines that the stream ID needs to be reused (S3 in FIG. 6).

すると、通信装置20のフレーム作成部204は、S106において、ストリームIDの再利用を要求するためのPINGフレームを作成する(図6のS4)。そして、再利用要求作成部208は、S107において、PINGフレームのフレームヘッダ51におけるFlagsフィールドに、再利用要求フラグとして0x2を書き込む(図6のS5)。また、再利用要求作成部208は、S108において、PINGフレームのOpaque Data領域に、ストリームIDの再利用を開始するIDを書き込む(図6のS6)。再利用を開始するストリームIDとして3を要求する場合、Opaque Data領域には0x3が書き込まれる。そして、フレーム送信部207は、S109において、ストリームIDの再利用要求が書き込まれたPINGフレームを通信装置30へ送信する(図6のS7)。このときフレーム受信部305は、ストリームIDの再利用要求が書き込まれたPINGフレームを通信装置20から受信する(図9のS24でYes)。   Then, the frame creation unit 204 of the communication device 20 creates a PING frame for requesting reuse of the stream ID in S106 (S4 in FIG. 6). In S107, the reuse request creation unit 208 writes 0x2 as a reuse request flag in the Flags field in the frame header 51 of the PING frame (S5 in FIG. 6). In S108, the reuse request creation unit 208 writes the ID for starting the reuse of the stream ID in the Opaque Data area of the PING frame (S6 in FIG. 6). When 3 is requested as a stream ID for starting reuse, 0x3 is written in the Opaque Data area. In step S109, the frame transmission unit 207 transmits the PING frame in which the stream ID reuse request is written to the communication device 30 (step S7 in FIG. 6). At this time, the frame receiving unit 305 receives the PING frame in which the request for reusing the stream ID is written from the communication device 20 (Yes in S24 of FIG. 9).

通信装置30は、PINGフレームを受信すると、S110において、フレーム作成部304によってPINGフレームへの応答を作成する(図9のS26)。通信装置20が再利用を要求しているストリームID=3がclosed状態である場合、ストリームID=3は再利用可能な状態である。そのため、この場合、応答作成部308は、S111において、ストリームIDの再利用要求を許可するオプションとして、0x5をPINGフレームのフレームヘッダ51のFlagsフィールドに書き込む。(図9のS27)。また、応答作成部308は、S112において、PINGフレームのOpaque Data領域に、再利用を許可するストリームIDの先頭の値として0x3を書き込む(図9のS28)。そして、フレーム送信部307は、S113において、ストリームIDの再利用の許可を応答するPINGフレームを通信装置20へ送信する(図9のS29)。また、ストリーム処理部312は、S114において、ストリームIDを再利用したストリーム上でのフレームの受信を開始する。一方、通信装置20のフレーム受信部205は、通信装置30から送信されたPINGフレームの応答を受信する(図6のS8)。   When the communication device 30 receives the PING frame, the frame creation unit 304 creates a response to the PING frame in S110 (S26 in FIG. 9). When the stream ID = 3 that the communication device 20 requests to reuse is in the closed state, the stream ID = 3 is in a reusable state. Therefore, in this case, in S111, the response creation unit 308 writes 0x5 in the Flags field of the frame header 51 of the PING frame as an option for permitting a stream ID reuse request. (S27 in FIG. 9). In S112, the response creation unit 308 writes 0x3 as the first value of the stream ID that is permitted to be reused in the Opaque Data area of the PING frame (S28 in FIG. 9). In step S113, the frame transmission unit 307 transmits a PING frame that responds to permission to reuse the stream ID to the communication device 20 (S29 in FIG. 9). In step S114, the stream processing unit 312 starts receiving frames on the stream in which the stream ID is reused. On the other hand, the frame receiving unit 205 of the communication device 20 receives the response of the PING frame transmitted from the communication device 30 (S8 in FIG. 6).

通信装置20は、通信装置30からPINGフレームの応答を受信すると、応答解析部209において、通信装置30から受信したPINGフレームを解析する(図6のS9)。通信装置30が送信したPINGフレームの応答におけるフレームヘッダ51のFlagsフィールドには、ストリームIDの再利用要求を許可する0x5が書き込まれている。そのため、再利用可否判断部210は、S115において、ストリームIDの再利用が可能であると判断する(図6のS10でYes)。また、応答解析部209は、通信装置30から受信したPINGフレームのOpaque Data領域を解析し、再利用が許可されたストリームIDを確認する(図6のS11)。
そして、フレーム作成部204は、S116において、ストリームIDを再利用してHEADERSフレームを作成する(図6のS2)。このとき、ストリームID=3を再利用する。次にS117では、通信装置20のフレーム送信部207は、S116において作成したHEADERSフレームを送信し、通信装置30のフレーム受信部305は、HEADERSフレームを受信する。また、通信装置30のストリーム処理部312は、S118において、ストリームIDを再利用したストリームを開く(open状態にする)。
When the communication device 20 receives the PING frame response from the communication device 30, the response analysis unit 209 analyzes the PING frame received from the communication device 30 (S9 in FIG. 6). In the Flags field of the frame header 51 in the response of the PING frame transmitted by the communication device 30, 0x5 that permits a stream ID reuse request is written. Therefore, the reusability determination unit 210 determines in S115 that the stream ID can be reused (Yes in S10 of FIG. 6). Further, the response analysis unit 209 analyzes the Opaque Data area of the PING frame received from the communication device 30 and confirms the stream ID permitted to be reused (S11 in FIG. 6).
In step S116, the frame creation unit 204 creates a HEADERS frame by reusing the stream ID (S2 in FIG. 6). At this time, stream ID = 3 is reused. Next, in S117, the frame transmission unit 207 of the communication device 20 transmits the HEADERS frame created in S116, and the frame reception unit 305 of the communication device 30 receives the HEADERS frame. In S118, the stream processing unit 312 of the communication device 30 opens a stream that reuses the stream ID (sets to the open state).

以上説明したように、本実施形態によれば、ストリームIDを再利用することができる。ストリームIDは、必ずしも連番で利用するわけではないため、実際に割り振られているストリームIDの個数よりも少ない数しか利用できず、使い切る可能性が高い。また、長時間の接続によってストリームIDの使用可能な範囲を超えてしまう場合もある。従来の通信システムにおいては、ストリームIDを使い切った場合、新しいストリームを確立するためには、一度コネクションを切断し、新しいコネクションを接続する必要があった。
これに対して、本実施形態では、ストリームIDを使い切った状態から新しいストリームを確立する場合には、通信相手に対してストリームIDの再利用要求を行う。そして、通信相手が再利用を許可した場合、ストリームIDを再利用してストリームを確立する。
As described above, according to the present embodiment, the stream ID can be reused. Since stream IDs are not necessarily used sequentially, only a smaller number than the number of stream IDs that are actually allocated can be used, and there is a high possibility that they will be used up. In addition, there are cases where the range of stream IDs that can be used is exceeded due to a long-time connection. In the conventional communication system, when the stream ID is used up, in order to establish a new stream, it is necessary to disconnect the connection once and connect a new connection.
On the other hand, in the present embodiment, when a new stream is established from a state where the stream ID is used up, a stream ID reuse request is made to the communication partner. When the communication partner permits reuse, the stream ID is reused to establish a stream.

ストリームIDの再利用を可能とすることで、コネクションの切断を行わずに通信相手と通信が可能な状態のストリームを確立することができる。その結果、コネクションの切断と新しいコネクションの接続にかかる時間を削減することができる。
このように、通信装置20は、コネクションの切断を行わずに、通信可能状態であるストリームを確立することができる。そのため、通信装置20が監視カメラである場合、コネクションの再接続の間に不審者が通過するというイベントが発生した場合には、即時に通信装置30に対して不審者が通過したことを通知することができる。したがって、リクエストを発行できない期間を低減することができる。
また、コネクションの切断と新しいコネクションの接続には、ネットワークの処理負荷がかかるが、コネクションを接続しなおす必要がないため、上記のネットワークの処理負荷を軽減することができる。
By making it possible to reuse the stream ID, it is possible to establish a stream that can communicate with the communication partner without disconnecting the connection. As a result, it is possible to reduce the time required for disconnecting a connection and connecting a new connection.
In this way, the communication device 20 can establish a stream in a communicable state without disconnecting the connection. Therefore, if the communication device 20 is a monitoring camera and an event occurs in which a suspicious person passes during connection reconnection, the communication device 30 is immediately notified that the suspicious person has passed. be able to. Therefore, it is possible to reduce the period during which a request cannot be issued.
Further, although the network processing load is applied to disconnection and connection of a new connection, since it is not necessary to reconnect the connection, the processing load of the network can be reduced.

(変形例)
上記実施形態においては、通信プロトコルとしてHTTP/2を例に挙げて説明したが、これに限定されるものではなく、SPDY(スピーディー)、QUIC(Quick UDP Internet Connections)であってもよい。また、1つのコネクション上で複数のストリームを処理する他のプロトコルにも適用可能である。
また、上記実施形態においては、通信システム10を監視カメラシステムに適用し、通信装置20をカメラ、通信装置30をPCとする場合について説明したが、これに限定されない。例えば、通信装置は、プリンタ、DVC(Digital Video Cassette)、プロジェクタ、医療機器、映像事務機、ブラウザ、スマートデバイスのアプリ、クラウドサービスにも適用可能である。
(Modification)
In the above embodiment, HTTP / 2 has been described as an example of the communication protocol. However, the communication protocol is not limited to this, and may be SPDY (speedy) or QUIC (Quick UDP Internet Connections). Further, the present invention can be applied to other protocols that process a plurality of streams on one connection.
Moreover, although the said embodiment demonstrated the case where the communication system 10 was applied to the surveillance camera system, the communication apparatus 20 was a camera, and the communication apparatus 30 was PC, it is not limited to this. For example, the communication apparatus can be applied to a printer, a DVC (Digital Video Cassette), a projector, a medical device, a video office machine, a browser, a smart device application, and a cloud service.

(その他の実施形態)
本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワーク又は記憶媒体を介してシステム又は装置に供給し、そのシステム又は装置のコンピュータにおける1つ以上のプロセッサーがプログラムを読出し実行する処理でも実現可能である。また、1以上の機能を実現する回路(例えば、ASIC)によっても実現可能である。
(Other embodiments)
The present invention supplies a program that realizes one or more functions of the above-described embodiments to a system or apparatus via a network or a storage medium, and one or more processors in a computer of the system or apparatus read and execute the program This process can be realized. It can also be realized by a circuit (for example, ASIC) that realizes one or more functions.

10…通信システム、20…通信装置、30…通信装置、40…ネットワーク、208…再利用要求作成部、209…応答解析部、210…再利用可否判断部、211…ストリームID管理部、212…ストリーム処理部、213…再利用要否判断部、308…応答作成部、309…解析部、311…ストリームID管理部、312…ストリーム処理部、313…判断部   DESCRIPTION OF SYMBOLS 10 ... Communication system, 20 ... Communication apparatus, 30 ... Communication apparatus, 40 ... Network, 208 ... Reuse request preparation part, 209 ... Response analysis part, 210 ... Reusability determination part, 211 ... Stream ID management part, 212 ... Stream processing unit, 213 ... Reuse necessity determination unit, 308 ... Response creation unit, 309 ... Analysis unit, 311 ... Stream ID management unit, 312 ... Stream processing unit, 313 ... Determination unit

Claims (17)

他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信装置であって、
すでに確立されたストリームの識別子を再利用するか否かを判断する判断手段と、
前記判断手段により前記ストリームの前記識別子を再利用すると判断した場合に、前記他の通信装置に対して、前記ストリームの前記識別子の再利用を要求する要求手段と、
前記判断手段により前記ストリームの前記識別子を再利用すると判断した場合に、前記識別子を再利用して、前記通信路上の前記ストリームを前記他の通信装置との通信が可能な状態に設定する設定手段と、を備えることを特徴とする通信装置。
A communication device capable of establishing a plurality of streams, which are logical communication channels to which identifiers are assigned, on one logical communication channel established with another communication device,
A determination means for determining whether to reuse an identifier of an already established stream;
Request means for requesting the other communication device to reuse the identifier of the stream when the judging means determines to reuse the identifier of the stream;
Setting means for setting the stream on the communication path to a state in which communication with the other communication device is possible by reusing the identifier when the determination unit determines to reuse the identifier of the stream. A communication apparatus comprising:
前記要求に対する前記他の通信装置からの応答を受信する受信手段をさらに備え、
前記設定手段は、
前記受信手段により前記他の通信装置が前記識別子の再利用を許可する応答を受信した場合に、前記識別子を再利用することを特徴とする請求項1に記載の通信装置。
Receiving means for receiving a response from the other communication device to the request;
The setting means includes
The communication apparatus according to claim 1, wherein when the other communication apparatus receives a response permitting reuse of the identifier, the identifier is reused.
前記設定手段は、
前記受信手段により前記応答として再利用を許可する前記識別子の情報を受信した場合に、再利用を許可された前記識別子を再利用することを特徴とする請求項2に記載の通信装置。
The setting means includes
3. The communication apparatus according to claim 2, wherein when the information on the identifier that permits reuse is received as the response by the receiving unit, the identifier that is permitted to be reused is reused.
前記判断手段により前記識別子を再利用しないと判断した場合に、すでに確立されたストリームの識別子よりも大きい値の識別子を用いて新しいストリームを確立する確立手段をさらに備え、
前記判断手段は、
前記確立手段が確立したストリームの前記識別子が、使用可能な最大値に到達したとき、すでに確立されたストリームの識別子を再利用すると判断することを特徴とする請求項1〜3のいずれか1項に記載の通信装置。
Further comprising establishing means for establishing a new stream using an identifier having a value larger than the identifier of the already established stream when the judging means judges that the identifier is not reused,
The determination means includes
4. The identifier of the stream already established is determined to be reused when the identifier of the stream established by the establishment unit reaches a maximum usable value. The communication apparatus as described in.
前記判断手段により前記識別子を再利用しないと判断した場合に、すでに確立されたストリームの識別子よりも大きい値の識別子を用いて新しいストリームを確立する確立手段をさらに備え、
前記判断手段は、
前記確立手段が確立したストリームの前記識別子が、使用可能な最大値よりも小さい所定の閾値を超えたとき、すでに確立されたストリームの識別子を再利用すると判断することを特徴とする請求項1〜3のいずれか1項に記載の通信装置。
Further comprising establishing means for establishing a new stream using an identifier having a value larger than the identifier of the already established stream when the judging means judges that the identifier is not reused,
The determination means includes
The identifier of the already established stream is judged to be reused when the identifier of the stream established by the establishing means exceeds a predetermined threshold value smaller than a maximum value that can be used. 4. The communication device according to any one of items 3.
前記判断手段は、前記他の通信装置から、すでに確立されたストリームの識別子の再利用が必要であることを示す通知を受信したとき、すでに確立されたストリームの識別子を再利用すると判断することを特徴とする請求項1〜3のいずれか1項に記載の通信装置。   The determination unit determines to reuse the already-established stream identifier when receiving a notification from the other communication apparatus indicating that the already-established stream identifier needs to be reused. The communication device according to any one of claims 1 to 3, wherein the communication device is characterized in that: 前記要求手段は、再利用を要求する前記識別子の情報を、前記他の通信装置へ送信することを特徴とする請求項1〜6のいずれか1項に記載の通信装置。   The communication device according to claim 1, wherein the request unit transmits the information of the identifier that requests reuse to the other communication device. 前記要求手段は、再利用を要求する前記識別子の区間の最小値を、前記他の通信装置へ送信することを特徴とする請求項7に記載の通信装置。   8. The communication apparatus according to claim 7, wherein the request unit transmits a minimum value of the section of the identifier that requests reuse to the other communication apparatus. 前記要求手段は、再利用を要求する複数の前記識別子の値を、前記他の通信装置へリストで送信することを特徴とする請求項7に記載の通信装置。   The communication device according to claim 7, wherein the request unit transmits a plurality of identifier values requesting reuse to the other communication device in a list. 他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信装置であって、
前記他の通信装置が、すでに確立されたストリームの識別子を再利用するとの判断を受けて送信した、前記ストリームの前記識別子の再利用の要求を受信する第一の受信手段と、
前記第一の受信手段により前記要求を受信したとき、前記再利用を許可するか否かを判断する判断手段と、
前記判断手段により前記再利用を許可すると判断した場合に、前記識別子を再利用したストリームを介してデータを受信する第二の受信手段と、を備えることを特徴とする通信装置。
A communication device capable of establishing a plurality of streams, which are logical communication channels to which identifiers are assigned, on one logical communication channel established with another communication device,
First receiving means for receiving a request for reuse of the identifier of the stream, which is transmitted in response to the determination that the other communication device reuses the identifier of the already established stream;
Determining means for determining whether to permit the reuse when the request is received by the first receiving means;
And a second receiving unit configured to receive data via a stream in which the identifier is reused when the determination unit determines that the reuse is permitted.
前記判断手段による判断結果を、前記要求への応答として前記他の通信装置へ送信する送信手段をさらに備えることを特徴とする請求項10に記載の通信装置。   The communication apparatus according to claim 10, further comprising a transmission unit that transmits a determination result by the determination unit to the other communication apparatus as a response to the request. 前記送信手段は、
前記判断手段により前記再利用を許可すると判断した場合に、前記応答として、自装置がデータを受信可能なストリームの識別子の情報を送信することを特徴とする請求項11に記載の通信装置。
The transmission means includes
12. The communication apparatus according to claim 11, wherein when the determination unit determines that the reuse is permitted, the apparatus transmits, as the response, information on an identifier of a stream from which the apparatus can receive data.
他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信装置であって、
すでに確立されたストリームの識別子の再利用が必要か否かを判断する判断手段と、
前記判断手段により前記ストリームの前記識別子の再利用が必要であると判断した場合に、前記他の通信装置に対して、前記ストリームの識別子の再利用が必要であることを通知する通知手段と、
前記判断手段により前記ストリームの前記識別子の再利用が必要であると判断した場合に、前記識別子を再利用した前記ストリームの処理を行う処理手段と、を備えることを特徴とする通信装置。
A communication device capable of establishing a plurality of streams, which are logical communication channels to which identifiers are assigned, on one logical communication channel established with another communication device,
A judging means for judging whether or not reuse of an identifier of an already established stream is necessary;
A notification means for notifying the other communication apparatus that the identifier of the stream needs to be reused when the judgment means judges that the reuse of the identifier of the stream is necessary;
And a processing unit configured to process the stream using the identifier when the determination unit determines that the identifier of the stream needs to be reused.
前記請求項1〜9のいずれか1項に記載の通信装置と、前記請求項10〜12のいずれか1項に記載の通信装置とが通信可能に接続された通信システム。   A communication system in which the communication device according to any one of claims 1 to 9 and the communication device according to any one of claims 10 to 12 are communicably connected. 他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信制御方法であって、
すでに確立されたストリームの識別子を再利用するか否かを判断するステップと、
前記ストリームの前記識別子を再利用すると判断した場合に、前記他の通信装置に対して、前記ストリームの前記識別子の再利用を要求するステップと、
前記ストリームの前記識別子を再利用すると判断した場合に、前記識別子を再利用して、前記通信路上の前記ストリームを前記他の通信装置との通信が可能な状態に設定するステップと、を含むことを特徴とする通信制御方法。
A communication control method capable of establishing a plurality of streams, which are logical communication paths to which identifiers are assigned, on one logical communication path established with another communication device,
Determining whether to reuse an identifier of an already established stream;
Requesting the other communication device to reuse the identifier of the stream when it is determined to reuse the identifier of the stream;
When it is determined that the identifier of the stream is to be reused, the identifier is reused to set the stream on the communication path to a state in which communication with the other communication device is possible. A communication control method characterized by the above.
他の通信装置との間に確立される1つの論理的な通信路上に、識別子が割り当てられた論理的な通信路であるストリームを複数確立可能な通信制御方法であって、
前記他の通信装置が、すでに確立されたストリームの識別子を再利用するとの判断を受けて送信した、前記ストリームの前記識別子の再利用の要求を受信するステップと、
前記要求を受信したとき、前記再利用を許可するか否かを判断するステップと、
前記再利用を許可すると判断した場合に、前記識別子を再利用したストリームを介してデータを受信するステップと、を含むことを特徴とする通信制御方法。
A communication control method capable of establishing a plurality of streams, which are logical communication paths to which identifiers are assigned, on one logical communication path established with another communication device,
Receiving the request for reuse of the identifier of the stream transmitted by the other communication device in response to the determination that the identifier of the already established stream is reused;
Determining whether to permit the reuse when receiving the request; and
And a step of receiving data via a stream in which the identifier is reused when it is determined that the reuse is permitted.
コンピュータを、前記請求項1〜13のいずれか1項に記載の通信装置の各手段として機能させるためのプログラム。   The program for functioning a computer as each means of the communication apparatus of any one of the said Claims 1-13.
JP2015128342A 2015-06-26 2015-06-26 Communication device, communication control method and communication system Pending JP2017011641A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2015128342A JP2017011641A (en) 2015-06-26 2015-06-26 Communication device, communication control method and communication system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2015128342A JP2017011641A (en) 2015-06-26 2015-06-26 Communication device, communication control method and communication system

Publications (1)

Publication Number Publication Date
JP2017011641A true JP2017011641A (en) 2017-01-12

Family

ID=57764193

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2015128342A Pending JP2017011641A (en) 2015-06-26 2015-06-26 Communication device, communication control method and communication system

Country Status (1)

Country Link
JP (1) JP2017011641A (en)

Similar Documents

Publication Publication Date Title
TWI533740B (en) Shared network access via a peer-to-peer link
US10412668B2 (en) Communication apparatus, communication method, and storage medium
JP6866191B2 (en) Communication equipment, communication control methods and programs
JP6242051B2 (en) COMMUNICATION DEVICE, COMMUNICATION DEVICE CONTROL METHOD, PROGRAM
JP6271843B2 (en) COMMUNICATION DEVICE, ITS CONTROL METHOD, PROGRAM
WO2016111246A1 (en) Wireless terminal
US9313345B2 (en) Information processing apparatus, system, and control method for information processing apparatus
WO2020054365A1 (en) Communication device, communication method, and program
JP6548445B2 (en) Communication device, communication method and program
US10015746B2 (en) Communication apparatus and control method thereof
JP6576099B2 (en) COMMUNICATION DEVICE, COMMUNICATION DEVICE CONTROL METHOD, PROGRAM, AND COMMUNICATION SYSTEM
US9596326B2 (en) Communication apparatus, communication method, and non-transitory computer-readable medium
US9900829B2 (en) Communication device, method for controlling the communication device, and program
US20190104561A1 (en) Communication apparatus, control method, and storage medium
JP2017011641A (en) Communication device, communication control method and communication system
US20130124729A1 (en) Communication apparatus and control method for communication apparatus
US9106608B2 (en) Communication device, communication method, and non-transitory computer-readable recording medium
US11363651B2 (en) Information processing apparatus, terminal apparatus, information processing method and program
JP6825215B2 (en) Electronic devices, terminals, wireless communication systems, and processing control methods
US10660147B2 (en) Communication apparatus, control method, and non-transitory computer-readable storage medium for controlling wireless connections
US9154960B2 (en) Wireless communication network construction terminal, wireless communication network participation terminal, wireless communication system, and wireless communication method
EP2959742B1 (en) Communication apparatus, control method thereof, and program
JP6998746B2 (en) Communication device, notification device, relay device, communication system, control method of each device, and program
JP2015139164A (en) Communication device, control method and program
JP2018007059A (en) Communication device, communication control method, and program