![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
|
|||||
|
Здравствуйте.
Подскажите, есть ли какие-нибудь варианты определить на клиенте или на клиенте в связке с каким-нибудь установленным серваком то что пользователь с серым IP под NAT-ом и RTMFP скорее всего у него не получится отправить или получить. Буду благодарен за наводки или идеи. cc.rtmfp.net, к сожалению, исключается Добавлено через 4 часа 8 минут Пробую следующее: Приложение на ФМС серверный скрипт var netConnection = new NetConnection(); var netGroup = null; var groupspec; application.onAppStart = function () { application.allowDebug = true; netConnection.onStatus = function(info) { if (info.code == "NetConnection.Connect.Success") { groupspec = new GroupSpecifier("discoverytest"); groupspec.multicastEnabled=true; groupspec.serverChannelEnabled=true; groupspec.postingEnabled = true; groupspec.routingEnabled = true; groupspec.peerToPeerDisabled = false; netGroup = new NetGroup(netConnection, groupspec.groupspecWithAuthorizations()); netGroup.onStatus = ngStatusHandler; } }; // Handle NetGroup status events; this simple example handles only the initial join. function ngStatusHandler(info) { if(info.code == "NetGroup.Posting.Notify") { // отсылка в группу полученных данных netGroup.post({message:info.message.message+"~"+Math.random()}); } } netConnection.connect("rtmfp://..."); } application.onConnect = function( client ) { application.acceptConnection( client ); } На флэше запускаю такой вот тестировщик package dev.div0 { import dev.div0.events.TesterResultEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.NetStatusEvent; import flash.events.TimerEvent; import flash.net.GroupSpecifier; import flash.net.NetConnection; import flash.net.NetGroup; import flash.utils.Timer; import mx.utils.ObjectUtil; [Event(name="tester_result", type="dev.div0.events.TesterResultEvent")] public class FMS_RTMFP_CapabilitiesTester extends EventDispatcher { private var nc:NetConnection; private var groupSpec:GroupSpecifier; private var netGroup:NetGroup; private var tempID:int; private var serverUrl:String; private var groupname:String; private var testerEvent:TesterResultEvent; private var testerTimer:Timer; private var testerTimerInterval:int = 5000; private var result:Boolean = false; public function FMS_RTMFP_CapabilitiesTester() { super(this); } public function test(serverUrl:String, groupname:String, tempID:int, timerInterval:int = 5000):void { this.testerTimerInterval = timerInterval; this.tempID = tempID; this.groupname = groupname; this.serverUrl = serverUrl; nc = new NetConnection(); nc.addEventListener(NetStatusEvent.NET_STATUS, netConnectionStatusHandler); //trace("connecting to "+serverUrl+" ..."); nc.connect(serverUrl); testerTimer = new Timer(testerTimerInterval,1); testerTimer.addEventListener(TimerEvent.TIMER_COMPLETE,timerCompleteHandler); } private function netConnectionStatusHandler(event:NetStatusEvent):void { switch(event.info.code) { case "NetConnection.Connect.Success": setupGroup(); break; case "NetGroup.Neighbor.Connect": netGroup.post({message:tempID}); break; case "NetGroup.Posting.Notify": parsePostingData(event.info.message); break; } } private function parsePostingData(data:Object):void { var message:String = data.message; var parts:Array = message.split("~"); if(parts[0] == tempID) { destroyTimer(); result = true; closeConnection(); sendResult(); } else { // wait for timer complete } } private function setupGroup():void { groupSpec=new GroupSpecifier(groupname); groupSpec.multicastEnabled=true; groupSpec.serverChannelEnabled=true; groupSpec.postingEnabled = true; groupSpec.routingEnabled = true; groupSpec.peerToPeerDisabled = false; netGroup = new NetGroup(nc,groupSpec.groupspecWithAuthorizations()); netGroup.addEventListener(NetStatusEvent.NET_STATUS,netConnectionStatusHandler); } private function closeConnection():void { netGroup.removeEventListener(NetStatusEvent.NET_STATUS,netConnectionStatusHandler); netGroup.close(); nc.removeEventListener(NetStatusEvent.NET_STATUS, netConnectionStatusHandler); nc.close(); netGroup = null; nc = null; groupSpec = null; } private function sendResult():void { testerEvent = new TesterResultEvent(TesterResultEvent.TESTER_RESULT); testerEvent.data = result; dispatchEvent(testerEvent); } private function destroyTimer():void { testerTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,timerCompleteHandler); testerTimer.stop(); testerTimer = null; } private function timerCompleteHandler(event:TimerEvent):void { destroyTimer(); sendResult(); } } } - вступление в NetGroup (та, которая создана с серверном скрипте) - отсылка в группу сообщения (свой ID) - если я смог услышать NetGroup.Posting.Notify в котором пришли отосланные мною данные значит есть возможность у пользователя подключаться и использовать rtmfp для входа в видеочат, например Не ошибся ли я с выводами ? Последний раз редактировалось djyamato; 16.10.2014 в 01:05. |
![]() |
Часовой пояс GMT +4, время: 09:39. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|