More Related Content
Similar to サーバレスモードRTMFP (20)
サーバレスモードRTMFP
- 3. RTMFP?
RTMFP は P2P 型、UDP ベース
[1] Stratus 2 または FMS のようなサーバに接続して利用。
[2] IP マルチキャスト可能な範囲(同一LAN内とか)であれ
ばサーバレスで P2P 通信できる(サーバレスモード)
参考
Flash Player 10.1 と RTMFP - akihiro kamijo
- 5. [1] NetConnection 作成
_nc = new NetConnection();
_nc.addEventListener(NetStatusEvent.NET_STATUS,
connectionStatusHandler);
_nc.connect("rtmfp:");
function connectionStatusHandler(event : NetStatusEvent) : void{
switch (event.info.code) {
case "NetConnection.Connect.Success":
// 接続確立された [2]へ
break;
}
}
- 6. [2] GroupSpecifierを作成
_gs = new GroupSpecifier( グループ名(任意) );
_gs.postingEnabled = true;
_gs.routingEnabled = true;
_gs.multicastEnabled = true;
_gs.ipMulticastMemberUpdatesEnabled = true;
_gs.objectReplicationEnabled = true;
_gs.addIPMulticastAddress("IPアドレス");//
225.225.0.1:30303 など
//Booleanプロパティのいくつは理解してない。。
- 7. [3] NetGroupを作成
※[1][2]が必要
_ng = new NetGroup(nc,
_gs.groupspecWithAuthorizations());
//イベントは全て、NetGroupのNetStatusEventをリス
ナーし、event.info.codeで判断する。(後述)
_ng.addEventListener(NetStatusEvent.NET_STATUS,
netGroopStatusHandler);
- 8. 他のpeerにデータ送信したい
NetGropu.post()
NetGroup.sendToNearest()
NetGroup.sendToNeighbor()
etc...
- 13. 他のpeerからのデータを受信したい。
function netGroopStatusHandler(event : NetStatusEvent) : void{
switch (event.info.code) {
case "NetGroup.Neighbor.Connect":
// ピア接続された ( event.info.peerID )
break;
case "NetGroup.Neighbor.Disconnect":
// ピアクローズされた ( event.info.peerID )
break;
case "NetGroup.Posting.Notify":
// グループ全員宛の通知を受け取った ( event.info.message )
break;
case "NetGroup.SendTo.Notify":
// 直メッセージ受信した( event.info.message )
break;
}}
- 17. 出典
librtmfp SparkProject
http://www.libspark.org/wiki/superbacker/librtmfp
LLC DigiFie » Flex勉強会 第156回@熊本+RIA セミナーへ行ってきました
http://www.digifie.jp/blog/archives/490
sendToNeighbor
http://www.flashrealtime.com/directed-routing-explained-flash-p2p/
Flash Player 10.1 と RTMFP - akihiro kamijo
http://cuaoar.jp/2010/03/flash-player-101-rtmfp.html
Adobe Flash Media Server 4.5 * RTMFP グループ
http://help.adobe.com/ja_JP/flashmediaserver/devguide/
WSa4cb07693d123884520b86f312a354ba36d-7ffe.html#WSf888d222081ca19c46a084fa12a8413080e-80
00
Editor's Notes
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n
- \n