Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reconnecting a broken stream

2 views
Skip to first unread message

Neeeol

unread,
Nov 22, 2006, 11:37:15 AM11/22/06
to
In our application we stream live audio/video images of an event and record
them for later review and playback. The power supply at our source locations
is not reliable, and even with UPSs we run into difficulties where a video
stream will be disrupted.

Once we have power restored, we want to reestablish the A/V stream from a
camera and "reconnect" it to it's original, so there is a single recorded
stream for the event from that camera even after power was lost. We also want
to reestablish the video connection in the flash players that lost the stream
when the outage occurred.

Can that be done?

FMS_Developer

unread,
Nov 22, 2006, 8:32:25 PM11/22/06
to
You can check the onStatus events of a working netconnection and netstream and
catch the various events. If you encounter an event of a loss of connection you
can reestablish the netstream (if your connection still is up) or even
reconnect again to your FMS server.

If you retry often enough (use some setInterval to see if you are connected
and if not, try again after xxx seconds) you will be able to maintain "maximum"
uptime.

You can reconnect your live upstream without any problems ; your customers
will see a frozen image when you upstreaming PC is down and it will continue to
work fine after the upstreaming PC is back online (and reconnected to your FMS)

Neeeol

unread,
Dec 14, 2006, 11:44:06 AM12/14/06
to
But the onStatus event is just that - an event. If the server drops off line
there is nothing to trigger the event in the first place. For instance, I see
no reference to a "the server disappeared" event. (I wouldn't expect one.)

Do I need to set up a timer, say every 3 seconds to simply test the connection
status? Will the NetConnection.isConnected return false if tested after the
server drops off line?

(Would be a lot easier just to get some UPS's!)

Neeeol

unread,
Dec 14, 2006, 4:46:40 PM12/14/06
to
I tested this idea by setting up a timer and checking NetConnection.isConnected
every 3 seconds. It kept reporting that the connection was good even after I
stopped the Flash Server. I don't know what that means, but it wasn't what I
expected.

JayCharles

unread,
Dec 14, 2006, 5:03:47 PM12/14/06
to
[q][i]Originally posted by: [b][b]Neeeol[/b][/b][/i]

I tested this idea by setting up a timer and checking
NetConnection.isConnected every 3 seconds. It kept reporting that the
connection was good even after I stopped the Flash Server. I don't know what
that means, but it wasn't what I expected.[/q]

I've run in to the same problem as well. Netconnection.isConnected doesn't
seem to be reliable at all. I like to call a remote method on an interval as
you mentioned in your previous post. It's a little frustrating to have to do
that, but at least it's reliable (it also creates a solution for missed
application.onDisconnect evens on the server side)

FMS_Developer

unread,
Dec 15, 2006, 3:35:13 PM12/15/06
to
[q][i]Originally posted by: [b][b]Neeeol[/b][/b][/i]
I tested this idea by setting up a timer and checking
NetConnection.isConnected every 3 seconds. It kept reporting that the
connection was good even after I stopped the Flash Server. I don't know what
that means, but it wasn't what I expected.[/q]

You really checked all events like netconnection.close and
netconnection.failed ?


http://www.adobe.com/livedocs/fms/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?c
ontext=LiveDocs_Parts&file=00000627.html

We do use the method mentioned by Jay too (by using a client- and server-sided
interval that checks the client's ping-time and ket the client reconnect or
disconnect the dirty client on the server to maintain a clear state of all
connected clients. The events however should trigger ; they do overhere tbh.

Trace the netconnection object and pull some plugs from your PC, switch/hub or
router to simulate a faulty network connection. Please do note that Windows
detects an unplugged networkcable which results in a "hard disconnect". If
you'd setup a simple hub/switch between your PC and your Lan you can pull the
networkcable from the hub/switch to the rest of the LAN which emulates a
connection-problem "in the middle" which cannot be detected by your (Windows)
OS.

We call this a soft disconnect and it can take 10-30 seconds before your Flash
client will notice a "disconnect" from the server. This is all related to
timeouts of tcp-packets and stuff which is way too deep and cannot be altered
anyway. You should however understand that network-timeouts of 5 to 10 seconds
CAN happen with a heavily loaded FMS and/or congested network.

Neeeol

unread,
Dec 18, 2006, 11:43:22 AM12/18/06
to
Thanks. All my searches did not turn up that particular page in livedocs - it's exactly what I was looking for. I will use the techniques you describe to add the robustness we need.

Thanks.

Neeeol

unread,
Dec 18, 2006, 2:35:33 PM12/18/06
to
The documentation for NetConnection.Connect.Failed states that:

"The [b]connection attempt[/b] failed; for example, the server is not running."

I interpret things fairly literally. When the stream has been successfully
initiated, and then drops out, does this event fire?

Ahamade

unread,
Jun 18, 2009, 2:52:27 PM6/18/09
to
I know it's already been quite some time. But can you guys help to explain a bit more about your solution? (Probably with source code?)

Thanks!

From http://www.developmentnow.com/g/73_2006_11_0_0_855236/Reconnecting-a-broken-stream.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

0 new messages