# NetConnection failing on second try

**URL:** <https://forum.kirupa.com/t/netconnection-failing-on-second-try/265871>\
**Category:** flash\
**Created:** [July 14, 2008, 1:20am UTC](https://forum.kirupa.com/t/netconnection-failing-on-second-try/265871 "2008-07-14T01:20:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![uberalles](https://avatars.discourse-cdn.com/v4/letter/u/e47774/32.png) [@uberalles](https://forum.kirupa.com/u/uberalles)\
**Post date:** [July 14, 2008, 1:20am UTC](https://forum.kirupa.com/t/netconnection-failing-on-second-try/265871/1 "2008-07-14T01:20:41Z")

</div>

I have a small audio stream between two clients in a chatroom app (using Red5 for the streaming). Now when I connect to Red5 on the first try everything works just fine. If I close the app and try again I get the following error:

```auto

Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Connect.Failed
 at lmt_tutor_test2_fla::MainTimeline/lmt_tutor_test2_fla::frame1()
Error #2044: Unhandled NetStatusEvent:. level=error, code=NetConnection.Connect.Failed
 at lmt_tutor_test2_fla::MainTimeline/lmt_tutor_test2_fla::frame1()

```

the code for the connection:

```auto

var ns_in:NetStream;
var ns_out:NetStream;
nc_out.connect("rtmp://localhost/oflaDemo");
nc_in.connect("rtmp://localhost/oflaDemo");

```

pretty straightforward.  
The really strange part is that if I restart Tomcat ( I also have Tomcat5 running on the same machine) it will work again (only the first time).  
I don’t have Tomcat touching a port anything close to what Red5 uses so how does restarting that webserver affect the NetConnection?  
Anyone else ever have this same sort of problem with NetConnection?  
Thanks in advance.
