UDP Native Extension for AIR Mobile – now with Android Support!

I’ve continued my work on my UDP AIR native extension, to add support for Android. I’m happy to release version 0.2, which adds Android support :-)

This means, from now on, you can send / receive UDP packets in your AIR mobile projects on both iOS & Android. If you find any bugs, or have suggestions, please let me know.

You can find the updated ane, sources and demo on github: https://github.com/wouterverweirder/AIR-Mobile-UDP-Extension

Enjoy!

10 Responses to “UDP Native Extension for AIR Mobile – now with Android Support!”


  • Really cool Wouter!

    Next up: a native extension to make up for the lack of ServerSocket support on AIR for Mobile? ;-)

  • HI Wouter,

    First off thanks for the extension, though I was done when I read UDP was unsupported for mobile.

    I am running into an issue with the data event, it seems its only getting dispatched once and I am not recieving the rest of the packets sent. Actually it seems I am not getting the full size of the first packet sent.

    I am developing for andriod; any help would be greatly appreciated!

    Jesse

  • hi Wouter,

    thanks for your great extensions. I was hoping to do a test sending and receiving data from my Android phone or iPad to my macBook, but when I add the .ane under the the Native Extensions tab in Flash Builder 6 in your UDPServer demo, it says: this ane does not support air-native-macosx-platform

    Is this extension platform specific? I don’t get the error i the mobile UDPClient demo. Any ideas? Thanks!

  • ah silly me,

    you don’t need the extension for desktop air, hehe, because it already supports UDP…

  • When testing this on an iPad 2 with AIR 3.1 I’m getting this error, any ideas?

    ArgumentError: Error #3500: The extension context does not have a method with the name initNativeCode.
    at flash.external::ExtensionContext/_call()
    at flash.external::ExtensionContext/call()
    at be.aboutme.nativeExtensions.udp::UDPSocket()[/Users/wouter/Documents/experiments/Flash Builder 4.6/UDPSocket/src/be/aboutme/nativeExtensions/udp/UDPSocket.as:57]

  • Hi Wouter,

    First of all, thank you for your extension for UDP sockets – it is very good contribution into AIR. It works well, but… I can’t see the ‘multicast’ methods (join group, leave group) in extension’s API. Did I miss something? Or it just isn’t implemented?

    So I would be very thankful for your input on this issue. Also I’m ready to help you to add ‘multicast’ behaviour of AIR extension.

  • Hi,

    I’m trying out your ANE, but it doesn’t receive broadcast packets. When I send broadcast packets from another machine in the local network, everybody in the network receive the packets but the UDPSocket on Android does not. It never fires the “data” event. It does work if I send the packets specifically to the IP address of the device.

    Is there any workaround to have it make it work broadcast packets too?

    thanks
    m.

  • Hi matteo,

    please read my message above – the reason of your problem is that the extension does not implement multicast behaviour of sockets (you called it ‘broadcast’)…

    Matteo, am I correct in my suggestions? I’ve just reviewed the implementation of ANE (for Android and iOS as well) – and it seems there is no support of Multicast. But I have ideas how to add this functionality.

    *** Take a look, how multicast receiving is handled natively on Android (http://docs.oracle.com/javase/tutorial/networking/datagrams/broadcasting.html).

    *** At iOS you can use C-library for BSD sockets (http://www.benripley.com/development/ios/udp-broadcasting-on-iphone-using-bsd-sockets/) or Objective-C fancy library CocoaAsyncSocket (https://github.com/robbiehanson/CocoaAsyncSocket) – especially class AsyncUdpClass. Also take a look at that SO question (http://stackoverflow.com/questions/3192989/ssdp-on-the-iphone).

    *** At Desktop (Windows and Mac) you can use a solution proposed by Luca Mezzalira (http://lucamezzalira.com/2011/07/29/multicast-udp-socket-in-adobe-air-with-python/) using Python.

    Summing up, I can tell that we can add missing multicast support to Wouter’s ANE. But I’m waiting for his response :) Maybe he already have implemented it, who knows :)

  • I haven’t had the time to add multicast support to the extension… I might add it in the future, but feel free to fork from github and add it yourself if you need it right now :)

  • Has anyone tested this on android ICS? it doesn’t seems to connect to the air server on desktop while it works on android 2.3. There’s no error too when debug with Flash builder with device connected. They are on the same wifi network

Leave a Reply