4

I'm currently writing a client in ActionScript 3 that talks to a Red5 application/media server via a NetConnection object. The server sends the client multiple types of data over this connection including video, audio and remote procedure calls. After an indeterminate amount of time (sometimes 10 seconds, sometimes 10 minutes) I see the following error in a popup window from my Debug version of the Flash client:

"Error: Error #2030: End of file was encountered."

I'm in the process of trying to figure out what's causing this error and the thing that's really driving me nuts is that I can't seem to catch it. I realize that the error probably indicates some low-level network read failing, but the fact that it generates a popup window in the debug flash player implies that I should be able to catch it.

Since the error has no associated stack trace, I went so far as to add the an uncaught exception handler on my base Sprite object:

public class MyClient extends Sprite
{
   public function FOWClient()
   {
      loaderInfo.uncaughtErrorEvents.addEventListener(UncaughtErrorEvent.UNCAUGHT_ERROR, uncaughtErrorHandler);
   }

   private function uncaughtErrorHandler(event:UncaughtErrorEvent):void
   {
      trace("UNCAUGHT EXCEPTION!!!");
   }        
}

My uncaught exception handler will get called properly if I purposely throw in some errors, but it never gets called when this Error #2030 happens.

So there are really two outcomes that would be acceptable to me:

  1. How the heck can I catch this "End of file was encountered" error and deal with it in code?
  2. If I can't catch it, are there any thoughts on what's causing it and how I fix that?

I'm pretty sure I've narrowed it down to having to do with RPC calls being made from my server to my client because when I disable those, but leave audio & video, I don't see the issue. Unfortunately, I don't yet have any good ideas beyond that.

Any help is appreciated. Thanks!

Brent Writes Code
  • 19,075
  • 7
  • 52
  • 56
  • I am not sure how to help you but I will give you some info on what happened to me that might give you some insight. I built a flash telnet client, full featured, full parsing, etc. while working out all the regEx's for parsing this error would pop up from time to time. It seems that if I tried to read beyond the byteArray that this error would occur (for obvious reasons in my case). I can't imagine the normal loader in as3 is doing that but that is what was causing it for me. – Feltope Mar 30 '11 at 23:38

2 Answers2

2

Some of this errors are thrown if the proper listener is not added.

Are you listening for asyncError and ioError events from your netconnection?

If not, just give it a try.

jbalsas
  • 3,484
  • 22
  • 25
0
try
{

}
catch( e : EOFError )
{
    trace( e );     // EOFError: Error #2030: End of file was encountered.
}
sth
  • 222,467
  • 53
  • 283
  • 367
rushkeldon
  • 1,343
  • 1
  • 10
  • 13