nc.close doesn't do jack... sometimes
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Macromedia Flash Server > nc.close doesn't do jack... sometimes




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    nc.close doesn't do jack... sometimes  
Jorge Maiquez


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-27-06 11:48 AM

Hey guys,

Don't know if anyone has come across this, or if this is a known issue, but
if nc.close() is called from within the onStatus handler (after a
"NetConnection.Connect.Succes"), then it doesn't do anything.


- Create an (empty) FCS/FMS app folder called "TestNcApp".
- Put the following code in a FLA and run it.

<-------------------

import mx.utils.Delegate;

nc = new NetConnection();
nc.onStatus = Delegate.create(this, onNcStatus);
nc.connect("rtmp://localhost/TestNcApp");

function onNcStatus(info:Object){
if(info.code == "NetConnection.Connect.Success"){
trace("Successful connection. Attempting close...");
nc.close();
}
else if(info.code == "NetConnection.Connect.Closed"){
trace("Closed the NetConnection");
}
}

------------------->

You'll not see the trace: "Closed the NetConnection".

Funnily enough, it does work if you put that close call in an interval, as
in the following code:


<-------------------

import mx.utils.Delegate;

nc = new NetConnection();
nc.onStatus = Delegate.create(this, onNcStatus);
nc.connect("rtmp://localhost/TestNcApp");

function onNcStatus(info:Object){
if(info.code == "NetConnection.Connect.Success"){
trace("Successful connection. Attempting close...");
ncIntvl = setInterval(delayClose, 1000);
}
else if(info.code == "NetConnection.Connect.Closed"){
trace("Closed the NetConnection");
}
}

function delayClose(){
trace("Delayed attempt to close the NetConnection");
clearInterval(ncIntvl);
nc.close();
}

------------------->

And it even works if you use a 0 (zero) instead of the 1000!
Go and figure.. 


-Jorge
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    RE: nc.close doesn't do jack... sometimes  
Stefan Richter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-27-06 11:48 AM

Could it be a scope issue?
Maybe this works?


import mx.utils.Delegate;

nc = new NetConnection();
nc.onStatus = Delegate.create(this, onNcStatus);
nc.connect("rtmp://localhost/TestNcApp");

function onNcStatus(info:Object){
if(info.code == "NetConnection.Connect.Success"){
trace("Successful connection. Attempting close...");
this.close();
}
else if(info.code == "NetConnection.Connect.Closed"){
trace("Closed the NetConnection");
}
}




> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of
> Jorge Maiquez
> Sent: 25 April 2006 18:33
> To: 'FlashComm Mailing List'
> Subject: [FlashComm] nc.close doesn't do jack... sometimes
>
> Hey guys,
>
> Don't know if anyone has come across this, or if this is a
> known issue, but if nc.close() is called from within the
> onStatus handler (after a "NetConnection.Connect.Succes"),
> then it doesn't do anything.
>
>
> - Create an (empty) FCS/FMS app folder called "TestNcApp".
> - Put the following code in a FLA and run it.
>
> <-------------------
>
> import mx.utils.Delegate;
>
> nc = new NetConnection();
> nc.onStatus = Delegate.create(this, onNcStatus);
> nc.connect("rtmp://localhost/TestNcApp");
>
> function onNcStatus(info:Object){
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     nc.close();
>   }
>   else if(info.code == "NetConnection.Connect.Closed"){
>     trace("Closed the NetConnection");
>   }
> }
>
> ------------------->
>
> You'll not see the trace: "Closed the NetConnection".
>
> Funnily enough, it does work if you put that close call in an
> interval, as in the following code:
>
>
> <-------------------
>
> import mx.utils.Delegate;
>
> nc = new NetConnection();
> nc.onStatus = Delegate.create(this, onNcStatus);
> nc.connect("rtmp://localhost/TestNcApp");
>
> function onNcStatus(info:Object){
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     ncIntvl = setInterval(delayClose, 1000);
>   }
>   else if(info.code == "NetConnection.Connect.Closed"){
>     trace("Closed the NetConnection");
>   }
> }
>
> function delayClose(){
>   trace("Delayed attempt to close the NetConnection");
>   clearInterval(ncIntvl);
>   nc.close();
> }
>
> ------------------->
>
> And it even works if you use a 0 (zero) instead of the 1000!
> Go and figure.. 
>
>
> -Jorge
>  ________________________________________
_______
> FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com http://training.figleaf.com
>

 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    RE: nc.close doesn't do jack... sometimes  
Jorge Maiquez


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-27-06 11:48 AM

Yeah, that's what I thought at first, but it's not. The following trace
shows that the nc is actually being targeted correctly:

..
if(info.code == "NetConnection.Connect.Success"){
trace("Successful connection. Attempting close...");
trace("Targeting nc with uri: "+nc.uri);
nc.close();
}
..

Dare I say the word... bug?

-J



-----Original Message-----
From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
[mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.
org] On Behalf Of Stefan Richter
Sent: 25 April 2006 20:49
To: 'FlashComm Mailing List'
Subject: RE: [FlashComm] nc.close doesn't do jack... sometimes

Could it be a scope issue?
Maybe this works?


import mx.utils.Delegate;

nc = new NetConnection();
nc.onStatus = Delegate.create(this, onNcStatus);
nc.connect("rtmp://localhost/TestNcApp");

function onNcStatus(info:Object){
if(info.code == "NetConnection.Connect.Success"){
trace("Successful connection. Attempting close...");
this.close();
}
else if(info.code == "NetConnection.Connect.Closed"){
trace("Closed the NetConnection");
}
}




> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of Jorge
> Maiquez
> Sent: 25 April 2006 18:33
> To: 'FlashComm Mailing List'
> Subject: [FlashComm] nc.close doesn't do jack... sometimes
>
> Hey guys,
>
> Don't know if anyone has come across this, or if this is a known
> issue, but if nc.close() is called from within the onStatus handler
> (after a "NetConnection.Connect.Succes"), then it doesn't do anything.
>
>
> - Create an (empty) FCS/FMS app folder called "TestNcApp".
> - Put the following code in a FLA and run it.
>
> <-------------------
>
> import mx.utils.Delegate;
>
> nc = new NetConnection();
> nc.onStatus = Delegate.create(this, onNcStatus);
> nc.connect("rtmp://localhost/TestNcApp");
>
> function onNcStatus(info:Object){
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     nc.close();
>   }
>   else if(info.code == "NetConnection.Connect.Closed"){
>     trace("Closed the NetConnection");
>   }
> }
>
> ------------------->
>
> You'll not see the trace: "Closed the NetConnection".
>
> Funnily enough, it does work if you put that close call in an
> interval, as in the following code:
>
>
> <-------------------
>
> import mx.utils.Delegate;
>
> nc = new NetConnection();
> nc.onStatus = Delegate.create(this, onNcStatus);
> nc.connect("rtmp://localhost/TestNcApp");
>
> function onNcStatus(info:Object){
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     ncIntvl = setInterval(delayClose, 1000);
>   }
>   else if(info.code == "NetConnection.Connect.Closed"){
>     trace("Closed the NetConnection");
>   }
> }
>
> function delayClose(){
>   trace("Delayed attempt to close the NetConnection");
>   clearInterval(ncIntvl);
>   nc.close();
> }
>
> ------------------->
>
> And it even works if you use a 0 (zero) instead of the 1000!
> Go and figure.. 
>
>
> -Jorge
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Re: nc.close doesn't do jack... sometimes  
Owen van Dijk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

I'm just kicking this old thread alive again, cause it's definitely a
bug ( FMS 2.02 ), i just implemented the workaround described below,
after seeing some really weird 'ghost' connections in the console
where connections where not closed even if there was a call to
nc.close(); we had up to 50% of our connections not being closed and
just sitting idle.

should we log a bug?

On 4/26/06, Jorge Maiquez <j_maiquez-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:
> Yeah, that's what I thought at first, but it's not. The following trace
> shows that the nc is actually being targeted correctly:
>
> ..
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     trace("Targeting nc with uri: "+nc.uri);
>     nc.close();
>   }
> ..
>
> Dare I say the word... bug?
>
> -J
>
>
>
> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of Stefan Richter
> Sent: 25 April 2006 20:49
> To: 'FlashComm Mailing List'
> Subject: RE: [FlashComm] nc.close doesn't do jack... sometimes
>
> Could it be a scope issue?
> Maybe this works?
>
>
> import mx.utils.Delegate;
>
> nc = new NetConnection();
> nc.onStatus = Delegate.create(this, onNcStatus);
> nc.connect("rtmp://localhost/TestNcApp");
>
> function onNcStatus(info:Object){
>   if(info.code == "NetConnection.Connect.Success"){
>     trace("Successful connection. Attempting close...");
>     this.close();
>   }
>   else if(info.code == "NetConnection.Connect.Closed"){
>     trace("Closed the NetConnection");
>   }
> }
>
>
>
> 
>  ________________________________________
_______
> FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


--
Owen van Dijk
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    RE: nc.close doesn't do jack... sometimes  
Stefan Richter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Remnind us again of the workaround. Is it the interval approach?

Stefan

[vbcol=seagreen]
> -----Original Message-----
> From: flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> [mailto:flashcomm-bounces-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gman
e.org] On Behalf Of
> Owen van Dijk
> Sent: 21 August 2006 12:27
> To: FlashComm Mailing List
> Subject: Re: [FlashComm] nc.close doesn't do jack... sometimes
>
> I'm just kicking this old thread alive again, cause it's
> definitely a bug ( FMS 2.02 ), i just implemented the
> workaround described below, after seeing some really weird
> 'ghost' connections in the console where connections where
> not closed even if there was a call to nc.close(); we had up
> to 50% of our connections not being closed and just sitting idle.
>
> should we log a bug?
>
> On 4/26/06, Jorge Maiquez <j_maiquez-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.o
rg> wrote: 


 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    RE: nc.close doesn't do jack... sometimes  
Stefan Richter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Just for the record and in order to eliminate Delegate as a source of the
problem, here's another piece of code which does *not* work as expected:

nc = new NetConnection();

nc.onStatus = function (info:Object)
{
trace(info.code)
if(info.code == "NetConnection.Connect.Success")
{
trace("Successful connection. Attempting close...");
closeNC();
}
else if(info.code == "NetConnection.Connect.Closed")
{
trace("Closed the NetConnection");
}
}

function closeNC()
{
trace("closeNC");
nc.close();
}

nc.connect("rtmp://localhost/TestNcApp");










 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Re: nc.close doesn't do jack... sometimes  
Owen van Dijk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Sorry, yup the delayed netconnection close using an interval:

private function delayedNetConnectionClose(
inConnection:NetConnection ) : Void {
trace("SuperClass.delayedNetConnectionClose(" +
inConnection.isConnected + ")");
inConnection.close();
trace("SuperClass.delayedNetConnectionClose(" +
inConnection.isConnected + ")");

// clear the interval
clearInterval( _delayedNetConnectionCloseID );
};


On 8/21/06, Stefan Richter <stefan-fMeCE+ULXElEfu+5ix1nRw@public.gmane.org> wrote:
> Just for the record and in order to eliminate Delegate as a source of the
> problem, here's another piece of code which does *not* work as expected:
>
>  nc = new NetConnection();
>
>  nc.onStatus = function (info:Object)
>  {
>    trace(info.code)
>    if(info.code == "NetConnection.Connect.Success")
>    {
>      trace("Successful connection. Attempting close...");
>      closeNC();
>    }
>    else if(info.code == "NetConnection.Connect.Closed")
>    {
>      trace("Closed the NetConnection");
>    }
>  }
>
>  function closeNC()
>  {
>         trace("closeNC");
>         nc.close();
>  }
>
>  nc.connect("rtmp://localhost/TestNcApp");
>
>
>
>
>
>
>
>
>
>
>  ________________________________________
_______
> FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>


--
Owen van Dijk
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Re: nc.close doesn't do jack... sometimes  
Owen van Dijk


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Looks i was too quick...forgot to add the following:

_delayedNetConnectionCloseID = setInterval( this,
"delayedNetConnectionClose", 10, nc );

i think a DoLater approach works as well...as the saying goes: if all
fails, wait 1 frame ;)

On 8/21/06, Owen van Dijk <owen.van.dijk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:[vbc
ol=seagreen]
> Sorry, yup the delayed netconnection close using an interval:
>
>          private function delayedNetConnectionClose(
> inConnection:NetConnection ) : Void {
>                 trace("SuperClass.delayedNetConnectionClose(" +
> inConnection.isConnected + ")");
>                 inConnection.close();
>                 trace("SuperClass.delayedNetConnectionClose(" +
> inConnection.isConnected + ")");
>
>                 // clear the interval
>                 clearInterval( _delayedNetConnectionCloseID );
>          };
>[/vbcol]

--
Owen van Dijk
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Re: nc.close doesn't do jack... sometimes  
Bill Sanders


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Owen,

I'd log a bug--in fact maybe we all ought to log bugs. Everyone at
Adobe has been suspiciously quiet lately. I wonder what's up. A new FMS?

Bill
On Aug 21, 2006, at 7:27 AM, Owen van Dijk wrote:

> I'm just kicking this old thread alive again, cause it's definitely a
> bug ( FMS 2.02 ), i just implemented the workaround described below,
> after seeing some really weird 'ghost' connections in the console
> where connections where not closed even if there was a call to
> nc.close(); we had up to 50% of our connections not being closed and
> just sitting idle.
>
> should we log a bug?
>
> On 4/26/06, Jorge Maiquez <j_maiquez-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.o
rg> wrote: 
>
>
> --
> Owen van Dijk
>  ________________________________________
_______
> FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcomm
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com

bill sanders | www.sandlight.com | bloomfield, ct | 860-242-2260


 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Re: Re: nc.close doesn't do jack... sometimes  


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-21-06 12:11 PM

Geachte heer/mevrouw,

Ik ben t/m 25 augustus afwezig. Ik zal uw mail daarna zo snel mogelijk in be
handeling nemen. Voor dringende zaken met betrekking tot WEBclusive kunt u o
ns kantoor bellen op het volgende nummer: 070-3699 817

Met vriendelijke groet,

Wouter van Vliet
WEBclusive
 ________________________________________
_______
FlashComm-1Ss2GqJETD3yZ38Mhd3e/9ZfFG6BLHNm@public.gmane.org
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcomm

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com






[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:32 AM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register