A journal that focuses on Flash Platform development, and a little bit about what I am up to on any given day.

Wednesday, July 13, 2005

SWFStudio3 - MultiUser without the Server

another feature I have played alot with in SWFStudio 3 is the UDP Plug-in. Below is a small exceprt from the documentation:


The UDP plugin enables the use of simple socket connections with SWF Studio applications. Using the UDP plugin, you can send and receive text messages using UDP datagrams, as well as broadcast messages to computers on a local subnet.

The UDP plugin uses connectionless sockets, making them very efficient for quick communication between computers. You can use this plugin in situations where it is not necessary to know if the transmitted message was received by the destination computer(s). It must also be noted that there is no guarantee as to the order in which messages will arrive. Though it is very unlikely, it is possible for two messages sent at almost the same time to arrive in the reverse order from which they were sent.

So basically you can create an instance of a UDP object, select a port, and start sending and recieving packets accross a network. This is great for internal chat systems, notification systems, the sky's the limit really.

SWFStudio has introduced a great Actionscript API in V3. That API provides better access to the functionality of SWFStudio, but I always find myself wrapping API's in Classes still in V3. This is not a complaint, it is just merely a matter of preference. The SWFStudio AS API is robust enough that you can code effectively directly at it, but I am just not a fan of allowing callbacks to run rampant in my production work.

As result I have built up a little code sample on the use of UDP, and within it I am including my UDP AS2 class, along with it's super, the Plugin Class. Using it looks like this:

////////////////////////////////////////////////////

myUDP=new UDP(6868);//port number

textArea_ta.onUDPData=function(event){
var ctext=this.text;
this.text=ctext+event.data.ip+">>"+event.data.msg+newline;
}

myUDP.addEventListener("onUDPData",textArea_ta);
myUDP.open();

////////////////////////////////////////////////////

Then send away like so:

myUDP.broadcastMsg("Hey guys! Check this UDP action!");

////////////////////////////////////////////////////

The source for my UDP class can be found here.

2 Comments:

Anonymous Jeff said...

hi Tony,

the link to the source file is dead, I'm really interested to see it :),

Jeff.

8:44 AM

 
Blogger DOMINOHALO75 said...

Kasus Pemerkosaan

Daftar Janda

Janda PSK

Pengetahuan Wanita

Kata Janda

Prediksi Janda

Janda Slots

3:55 PM

 

Post a Comment

<< Home