Port
For a complete list of ports and protocols Flash Media Server uses to communicate, see Configure ports in the Flash Media Server Configuration and Administration Guide.
To test whether a client can connect to a Flash Media Server hosted by Stefan Richter of TheRealTimeWeb, see Port Tester. To test whether a client can connect to your server, use a Port Tester developed and hosted by Jake Hilton.
By default, Adobe Flash Media Server communicates with clients over the following ports (this list is simplified):
|
Protocol |
Transport |
Description |
1935 |
RTMP/E |
TCP |
Flash Media Server listens for RTMP/E requests on port 1935/TCP. Flash Player and AIR clients attempt to connect over ports in the following order: 1935, 80 (RTMP), 80 (RTMPT). |
1935 |
RTMFP |
UDP |
Flash Media Server listens for RTMFP requests on port 1935/UDP. |
80 |
RTMP, RTMPT, HTTP |
TCP |
Flash Media Server listens for HTTP requests on port 80. Flash Media Server falls back to port 80 if a client cannot con |
8134 |
HTTP |
TCP |
Flash Media Server forwards HTTP requests to Apache HTTP Server on port 8134. |
1111 |
HTTP, RTMP |
TCP |
Flash Media Administration Server listens for HTTP and RTMP requests on port 1111. |
Some firewalls reject traffic that doesn't use the HTTP protocol. This behavior can prevent communication over RTMP even if port 1935 is open. Consult the documentation for the firewall to determine how to configure it to allow RTMP traffic.
To use RTMP and RTMFP, firewalls between the server and clients must allow inbound and outbound traffic on port 1935. If you cannot configure the firewall to allow traffic on port 1935, configure the server to use a different port. Configure the port in the fms.ini file or in the <HostPort> tag of the Adaptor.xml file. See Configure ports.
If you configure the server to use a port other than 1935, specify the port in the NetConnection.connect() statement. In client-side ActionScript, if a port is specified in the NetConnection.connect() statement, Flash Player attempts to connect only on the specified port:
nc.connect("rtmp:/mydomain.com:80/myAppName");
If the NetConnection.connect() statement does not include a port, Flash Player attempts to connect over 1935. If a connection is not made, Flash Player attempts to connect using port 80, and then port 443.
nc.connect("rtmp:/mydomain.com/myAppName");
Although Flash Player automatically attempts to connect to Flash Media Server over multiple ports, the time between connection attempts can be longer than you would like. Also, you sometimes want to attempt to connect over more ports than Flash Player uses by default. Jake Hilton has created a class called NetConnectionSmart that quickly connects a client to Flash Media Server through a firewall. The NetConnectionSmart class also includes properties that let you choose whether to use RTMPE, whether to use tunneling, and so on.
You can also write your own ActionScript that uses multiple ports to connect to Flash Media Server. The following is a simple example:
function init() { portList = [1935, 80, 443, 8080, 7070]; i = 0; nc = new NetConnection(); nc.onStatus = function(info) { if (info.code == "NetConnection.Connect.Failed") { trace("failed on "+portList[i]); i++; connectInterval = setInterval(doConnect, 100); } else if (info.code == "NetConnection.Connect.Success") { //call other functions here trace(nc.uri+": "+info.code); } }; doConnect(); } function doConnect() { clearInterval(connectInterval); trace("i is: "+i+" and portList[i] is: "+portList[i]); nc.connect("rtmp://yourDomain.com:"+portList[i]+"/yourAppName"); } init();
To use this code, change yourDomain.com to the domain of your Flash Media Server. Change yourAppName to the name of the application on the server. To attempt to connect to additional ports, add port numbers to the portList array. Use setInterval() and clearInterval() to spread the connection attempts over time. Use an interval from 1 to 100 milliseconds.