10 Replies Latest reply on Jun 29, 2011 2:31 AM by Karl_Sigiscar_1971

    Flash and UDP

    Zolotoj Level 3

      Is it possible to receive data via UDP into a Flash application?



        • 1. Re: Flash and UDP
          Claudiu Ursica Level 4

          It is possible in AIR only checkflash.net.DatagramSocket;


          Also the new RTMFP protocol is ude based so with flash player 10 and FMS you

          could do it.



          • 2. Re: Flash and UDP
            Zolotoj Level 3

            I tried flash.net.DatagramSocket.

            I am getting no errors, but the serial interface that that device has is not getting open, another words, Flash command "connect" is not reaching the device.

            • 3. Re: Flash and UDP

              you might want to post your code and a few more details so we can see what's going on and can help you out.

              • 4. Re: Flash and UDP
                masterkrang Level 1

                you might want to post your code and a few more details so we can see what's going on and can help you out.

                • 5. Re: Flash and UDP
                  Ric Moore

                  Did you try sending the policy file when connecting?


                  Has anyone managed to get this to work yet?

                  • 6. Re: Flash and UDP
                    srvikram13 Level 1

                    Its absolutely, undoubtedly not possible to connect to a UDP socket from within Flash (unless of course you are within the application sandbox of an AIR application).


                    Outside of AIR, Flash can only connect to TCP/IP sockets that too the ones that are specified in the cross-domain xml. This is true even if the swf domain is same as that of the target socket.

                    Also, the cross domain xml needs to be served by a socket on the same domain (not necessarily the same port & the target socket).

                    For Flash Player 10 onwards, this xml should come as plain text response over the socket (basically to avoid any HTTP headers).


                    Moral of the story: UDP not possible (as of now) if you working on a browser-based application. And, cross-domain policy file needs to be server over a socket & not as an xml file from a webserver (even if) on the target domain.


                    Hope this helps!

                    • 7. Re: Flash and UDP
                      Ric Moore Level 1

                      Surely you can use UDP with Flash 10.2 using NetGroup.post()?

                      I've done it and I found if you don't send a sequence number with it that packets will often arrive in the wrong order which infers it's not TCP based.



                      • 8. Re: Flash and UDP
                        srvikram13 Level 1

                        AFAIK NetGroup class definitely uses RTMFP (that is UDP-based but a different protocol altogether) sockets and is used mainly for P2P communication that too(but I'm not sure about this) using FMS like Claudiu Ursica already mentioned.


                        As per what I understand- for a Flash application based on Client-Server Architecture & runnning outside of the AIR application sandbox, connecting to a UDP socket is not possible..like I said- "as of now" but you never know!

                        • 9. Re: Flash and UDP

                          Hi Ric Moore


                          Can you explain more on "sending the policy file when connecting"? I used the UDP example from the Adobe site but it doesn't seem to listen to the port until I use other port listen program. I thought it was some kind of security issue.



                          • 10. Re: Flash and UDP
                            Karl_Sigiscar_1971 Level 3

                            Adobe Director and the Shockwave Player have Flash Player embedded and Director can use the UDP protocol...


                            I don't know if that would do in your case though.