Is it possible to force a source port on a NetConnection?

369 views Asked by At

I'm new to ActionScript, but I'm trying to decipher a pre-existing project and make some modifications as I go.

I have a section of code that starts with creating a new NetConnection and then streaming a media file from an external source. I see in the documentation that you can provide a destination port (via the URL), but is it possible to force Flash to use a specific source port? I couldn't find a clear way to do this in the documentation, but I was curious if anyone else has an alternate method or idea.

The end goal of this is that I would like to be able to use the source port in a predictable way to do NAT Hole Punching. Thanks for any suggestions or answers!

3

There are 3 answers

1
Samuel Neff On BEST ANSWER

Flash does not provide this level of control over the network calls. Sorry.

1
Sean Fujiwara On

I think you're looking for tunneled RTMP, which wraps packets in HTTP and uses port 80. To use it just connect with the protocol "rtmpt" instead of "rtmp". Your FMS server should be configured to listen on port 80 for this purpose.

1
Netcfmx On

use this syntax

connect ()  method   
public function connect(command:String, ... arguments):void

use this syntax as command parameter

protocol:[//host][:port]/appname[/instanceName]