Skip to main content
Participant
December 8, 2013
Question

NetGroup not working for LAN communication on AIR iOS apps from AIR 3.5 on

  • December 8, 2013
  • 0 replies
  • 311 views

Help!

Trying to upgrade my app for IOS 7.

I'm using the following code to communicate between AIR IOS apps within LAN.

It works with AIR 3.2 but not with AIR 3.5-3.9...

No error message, just not able to receive data with NetGroup.

Any suggestions on LAN communications will be appreciated


public function P2P_POST(_message:Function=null) {
      //connect;
      if (_message!=null) {
           func = _message;
      }
      nc = new NetConnection();
      nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
      nc.connect("rtmfp:");
}


private function connect():void
{

}


private function netStatus(event:NetStatusEvent):void
{
      switch(event.info.code)
      {
           case "NetConnection.Connect.Success":
                setupGroup();
                break;
           case "NetGroup.Connect.Success":
                this.dispatchEvent(new Event("CONNECT_SUCCESS"));
                break;
           case "NetGroup.Posting.Notify":
                if(func!=null){
                     func(event.info.message);
                }
                break;
           case "NetGroup.Neighbor.Connect":
                trace("NetGroup.Neighbor.Connect");
           case "NetGroup.Neighbor.Disconnect":
                break;
      }
}

private function setupGroup():void
{
      trace("setupGroup;");
      var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/IPAD2FLASH_SERVER");
      groupspec.postingEnabled = true;
      groupspec.ipMulticastMemberUpdatesEnabled = true;
      groupspec.addIPMulticastAddress(DataInstance.getInstanse().IP_GROUP);
      group = new NetGroup(nc,groupspec.groupspecWithAuthorizations());
      group.addEventListener(NetStatusEvent.NET_STATUS,netStatus);
}

public function postObject(obj:Object,_type:String) {
      var message:Object = new Object();
      message.obj = obj;
      message.type = _type;
      message.random = new Date().time;
      message.sender = group.convertPeerIDToGroupAddress(nc.nearID);
      group.post(message)

}

This topic has been closed for replies.