ActionScript 3.0 :: Socket - Keep It Alive / Reconnect Every Time You Need It?
Oct 26, 2009
What would be the better approach for using the Sockets in AS3.
1st) open one connection and keep it alive until the site unloads?
2nd) open a connection, use it, and close it when done; then, open again when I need?
Considering a scenario where some users will make a constant use of the Socket, but others will almost not use it, what would be the better approach? Does an alive Socket connection use too much bandwidth? Does the action of connecting consumes more than keeping it alive?
I would like Flash to reconnect to a socket if its connection is dropped. I am using the Socket class to establish a connection and then adding an Event.CLOSE listener to the socket. What is a good strategy to reconnect back to the socket if the connection has suddenly closed? Here is a the method I am calling inside the close handler. The connect() method establishes a new socket connection
HTML Code: private function handleOutage():void { // if socket is not connected
When I send number (int)52 s.Send(BitConverter.GetBytes((int)872415232));, flash show me trace(socket.readInt()); 872415232 If i send 872415232, flash show 52.Why? And how it fix?
I have a VideoDisplay that is able to connect to a source and play. After the connection times out I want the connection to be re-established when my play button is clicked. Right now when I reset the source and play the videoDisplay, it gets stuck in the loading state.
In an effort to tidy up my large folder I accidentally moved a fla. file and now I cannot open it.
[Code]...
I tried moving the file back into it's original folder but that did not change things. Is there anything I can do or should I start to accept that it's gone?
When streaming a live event through FMS 3.5, is there a list of guidelines or best practices to handle the situation when the stream disconnects and should reconnect.Basically, what I do now is wait 20 seconds after the initial disconnect, then close the stream and ask the user to ty to reconnect to the stream again.
I have a problem where I'm streaming a video via RMTP from akamai for a video serving site and an issue has come up during QA where a user starts a video stream and then disconnects their internet connection, which causes the video player to go into the buffer state. The problem occurs when they reconnect their internet connection and we'd like to pick up the stream again.
I have a little problem with a simple URLLoader,it simply just loads the data from an url, and processes that data, nothing complicated. But, when ever i run it, it leaves the connection open. At the bottom of the browser it says:
Transfering Data From www....
The data is read sucessfully, so it should close the connection? but doesnt seem to want to do it. Is there anyway to close all open connections, or somehow remove such message?
I have page in my asp.net mvc website with a flash app on it, and the user can stay on that page for hours, but his auth cookie/session is going to expire, so I'm thinking to create a PingController and to call it using jquery $.post each 20 minutes.
My flex application generates individual pdf documents based on individual selection criterion,but i need to merge those generated pdfs or is it possible to store individual pdfs temporarily then merge those into single pdf?
Is there a way to directly print using alive pdf (by passing the step where it saves the datagrid in pdf). Right now I am using Alive Pdf for generating PDF from datagrid and its doing a great job. Since flex printing by itself sucks I was wondering if I could directly print using Alive PDF?
Alive Flash Slideshow Maker is a professional slideshow builder to easily create high-impact photo slideshows. It turns your digital photos to flash ( SWF ) slideshow with background music and transition effects. So that you can upload the output flash file to websites and share your memorial moments with your family and friends. You can also post the flash slide show on MySpace, facebook, YouTube, or your Blog.
With this extremely easy to use flash slideshow maker, You don't need to learn any additional skills to make a flash slideshow. Simply drag & drop the photos into Alive Flash Slideshow Maker, click "Publish" and a stunning flash slide show will be generated. Alive Flash Slideshow Maker supports almost all picture formats including JPEG, BMP, GIF, TIFF, PNG, PSD, RAW, WMF, EMF, etc.
Features:-Output Flash (.SWF) File and HTML pageCreate two files: a Flash (SWF) file and a HTML page file. This allows you to share the slideshow via uploading the two files to your website simply..-Output Flash (.SWF) FileCreate a standalone Flash (SWF) file only. But the corresponding HTML code will be generated for embedding the flash slideshow into your own webpage. You will be able to copy and paste the code into any webpage.-Output Executed Flash File (.EXE)Create an executable Flash slideshow (.exe file). So that you can play and share the slideshow without webpage and browser. Just double click the generated .EXE file, the slideshow will be played without any Internet Browser.
working with a AS3 flash movie button linking to an html form
I have a client that wants to keep the browser session going when it comes to a form being filled out and to pre-fill this data where necessary so basically for Flash to check the user URL and see if there are session keys attached to the URL..
I need Flash to look at the incoming URL which may already have keys attached such as 'uVB2GC1F/xGG3QX1F' and use them by adding them to a button link. These keys will be different every time for each session.
Any standard way to keep alive the http session as long user has open the flex app in the browser? I played around with the polling mechanism of blazeds. But it had no affect on the http session.
I see this type of apparent magic in all sorts of AS3 code, but here is a reduced example:
[Code]...
As indicated in the code comment, the loader variable should fall out of scope after the URLLoaderExample constructor. However... it still seems to be kept alive (not garbage collected) somewhere since the onComplete listener/handler is able to receive it cleanly. Where is the magic/hidden/global reference to loader that keeps it alive so that it can complete it's load operation, and then be handed to the onComplete listener/callback? Can this reference be seen somewhere?
To help with context... as a similar example, I know that the loader instance will have the onComplete listener registered. I also know I need to be careful to use removeEventListener at all times (?) to avoid potential memory leaks resulting from stranded listeners. What concerns me is that I don't understand where the magic loader reference is and whether (or when) I need to clean that up.
I'm creating a client-server game. My client is a flex based game, and my server is erlang server. At the beginning, when I test directly my flex client in flash player, I can establish a connection easily to my erlang server through socket connection. And both can exchange data with no problem. The problem rise when I deploy my flex app at Apache http server, and running it using a browser by calling [URL] my flex socket sends message requesting for a crossdomain policy to my erlang server. So I create an xml message that represent a crossdomain policy, and send it back to my flex app as a response for that request.
Yet still I can't establish any permanent socket connection between my flex client and my erlang server. I know this because I add listener on my flex socket that will modify its internal state to CONNECTED, if a connection between client-server has established.
Im trying to create a pdf in high resolution in 300dpi with pdf alive for flex, i used this code: var image:ImageSnapshot = ImageSnapshot.captureImage(page[i], 300, new JPEGEncoder()); but i create the pages with a loop for(), and this makes that my web aplication crashed, beacause it spend a lot of time to create the PDF. Exist some way to create this process in the background but dont want the .swf to freeze while the number crunching happens, or another way to create pdf in high resolution(300dpi) with flex.
First,i am in project for creating some website with streaming video.The connection to the host is bad and i need to know if Flash media server can reconnect if connection is lost during playback and second,is there some kind of plugin for subtitles,this is very important,If there is a positive answers on those two questions,the third would be "where can i buy it and how"?
Steve Jobs just posted this article on why Apple rejects Flash... [URL] I agree that javascript and css can be used to replicate some of Flash's animation, though Flash does all sorts of scaling and tweening that is incredibly powerful, and I'm not sure that there's anything comparable in javascript, if there is, I certainly haven't seen it.
However, my question is about the socket. Flash has an incredibly powerful openSocket class that allows you to connect to a server and have the server and the client talk back and forth to one another. As far as I know there is no equivalent class in Javascript. Am I mistaken? Is there some secret mystery Ajax class that replicates the openSocket? If not, then that feature alone makes Flash an invaluable tool.
I don't need to deploy an HTTP server and all the connections are made on port 80, the default HTTP port, which is generally not blocked by firewall.Unfortunatly at the end of my work I realized that the flash socket component has some limitation on using port 80.[URL]As nobody is interested by this report, I now think that this limitation is done on purpose by Adobe. I don't know exactly why, may be to force to use their data service product.
I can understand that. But what I am hangry about is that nowhere in the documentation of the socket component there is an information about this limitation. I guess lot of people lost time trying to reach an unreachable goal ! And most of the time you find the problem at the end of the work because local connection is working ok on port 80.
I have this Socket (not XMLSocket, just Socket) client. I also have a custom PHP script on my server, that listens on port X. My client tries to connect to it.Everything works fine, the security and communication, sync and whatever else. But - the Flash Player (AIR runtime actually) shoots an error when trying to connect, but ONLY when the server is not running... the error is actually handled by try catch (IOError), and even weirder, the line that is specified in the output as the error line is the line where I just CREATE the Socket...?
Output:
Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error. at ---.server::Client()[/DevProjects/Libs/ASLibs/---/server/Client.as:167] at Function/<anonymous>()[---_fla.MainTimeline::frame1:430][code].....
when I comment out the line where I actually connect using Sock.connect(...) - it does not throw the error, but it obviously does not work... Also, the connect part is also in try catch (IOError) block...
I am trying to communicate using this protocol. It works fine except when the socket has a lot of data to return. Right now I am checking if a packet ends with to determine if I have received all the packages. Problem is that sometimes a package can end with as a line break even if it is not the last package, so I can not use that.
I am using a command queue, because I want to wait for a complete response before sending the next command.
The code with unnecessary stuff removed:
class CustomSocket extends Socket { private var _response:String; private var _commandQueue:Array;
[Code]....
The problem is in the function readResponse. I've googled a lot without finding anything of interest.
Is there a way to know the total amount of bytes/packets a socket will return? Or a way to detect EOF or that a package is the last?
I am currently working on a project that involves using sockets. I am using Flash CS5 and AIR2.0. I am also using another program that will be acting as the socket server (Esperient Creator).I have successfully SENT socket commands from my AIR app to the server.What I need to do is RECEIVE socket commands within my AIR app from the server program. I read somewhere that this was a new feature for AIR 2.0. If anyone has any insight on how to get this to work.
I have a custom socket class designed to connect to a server and talk with it. At one point, the server uses hex data for speed, however Flash seems to not get ANY of this data. In fact, it doesn't get ANY of the data from that point to the next packet.