Skip to main content
Participant
January 30, 2008
Question

FMS 2 closing connections

  • January 30, 2008
  • 2 replies
  • 575 views
I am relatively new to the FMS.

I was trying a live cast sample application. The problem I am facing is that although the client side code does a "nc.close" (and the status is also received appropriately at the client), the connection is not closed at the FMS. I tried a lot of googling but couldnt find anything to force the close at the server. Is this a unique case, or is this behaviour normal. If it's normal, then how do I close the connection at the server gracefully?

Siva.
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    Graeme Bull
    Community Expert
    Community Expert
    January 30, 2008
    How do you know that the client is still connected? Double check in the clients tab of the FMS admin to make sure.

    The only other thing I can think of is that a keep-alive point inbetween you and the FMS server is keeping the connection alive... but that's weird, shouldn't happen at all. Especially if you are getting back a status message saying you are disconnected. Are you sure the app isn't just reconnecting again automatically or something?
    syellamrAuthor
    Participant
    January 31, 2008
    I see the client still listed in the FMS Admin Console. The connection dies off after a minute or so, but thats too late because it obstructs the other connections trying to publish with the same stream name.

    The code for the swf is listed below, the connection is not reopened.

    The important point is the connection stays alive even when the client's browser window is closed.

    --
    nc = new NetConnection();
    nc.connect("rtmp://gimme.homelinux.net/livecast/");
    ns = new NetStream(nc);
    mycam = Camera.get();
    mycam.setMode(600, 400);
    mycam.setQuality(25600, 0);
    //mycam.setQuality(0, 0);
    mymic = Microphone.get();
    mymic.setRate(11);
    ns.attachVideo(mycam);
    ns.attachAudio(mymic);
    ns.setBufferTime(0.1);
    ns.publish("abc", "live");

    nc_tv = new NetConnection();
    nc_tv.connect("rtmp://gimme.homelinux.net/myliveapp/instance1");
    ns_tv = new NetStream(nc_tv);
    myvid.attachVideo(ns_tv);
    ns_tv.play("mylivestream", -1);
    ns_tv.setBufferTime(0.1);



    //startstop_pb.enabled = false;

    connect_pb.onRelease = function(){
    if(this.label == "Connect"){
    status_txt.text += "Connecting..." + newline;
    this.label = "Disconnect";
    nc.connect(rtmp_txt.text);
    } else {
    mymic.clear();
    myvid.clear();
    ns.attachVideo(null);
    ns.attachAudio(null);
    ns.close();
    nc.close();
    nc.close();
    ns_tv.close();
    nc_tv.close();
    }
    }

    startstop_pb.onRelease = function(){
    if (this.label == "Start Broadcast"){
    status_txt.text += "Starting broadcast" + newline;
    this.label = "Stop Broadcast";
    ns.publish(streamname_txt.text, "live");
    } else {
    status_txt.text += "Stopping broadcast" + newline;
    this.label = "Start Broadcast";
    myvid.attachVideo(null);
    myvid.clear();
    ns.close();
    }
    }

    ---