go back to the articles list

How do I test the server after a fresh install of FMS2?

So here we are with another question about FMS that can hopefully be answered below :)

The question: How do I test the server after a fresh install of FMS2?

The answer:
OK, so you've installed the server, whether it's windows or linux it doesn't really matter at this point, and you want to see if it's working. The first step is to find your way to the applications directory. If you installed by default, then this will be in the install directory. As a best practice though, I recommend moving it to a different drive than the boot drive, as it's not much different than a web server in a way that you will be placing lots of files in there and also making video/audio and data files that could potentially take up a lot of space.

So, the server is installed, the service is running and you can login to the admin console that comes with it. You're in the applications directory, so go ahead and create a directory called "myfirstapp". Notice that I have kept the application name all lowercase. If you're on a Windows server it doesn't matter, but for linux it's important which case you have the letters in when you try to connect up to it from a SWF. It's just easier and a better practice to keep it all lowercase.

Anyways, you've created the application folder in the applications directory. This now allows you to connect up to the server to this specific application. You'll do this with the following script in an FLA.

We'll do this in AS2 because it's also a good practice. Copy and paste if you want:

//create the net connection object
var nc:NetConnection = new NetConnection();

//set up the onStatus information object so we can see what is happening
nc.onStatus = function(info){
//trace the code object in the information object that is passed into the onStatus event
trace(info.code);
}

//connect up to the server. Put in your own IP address for your server in place of the IP number below. Or the domain name of the server
nc.connect("rtmp://111.111.111.111/myfirstapp/first_instance");

If all is well, the trace should return back in the output panel in flash that there was success.

If not, and this is the part that isn't documented so well in some places, then you need to debug what is happening. The first place to start is the onStatus event. If you get back that the connection was rejected, the first place to look is the application name that you put in the connect method. If that application does not exist on the server, as you created in the applications directory, then the server will automatically reject the connection. If it just fails then there are a couple of other items to look at. The first would be to make sure that the port is open that the server is trying to connect up on.

FMS by default uses port 1935. You can set it up to use any port really, but it's best to use port 80 (works out of the box with no web server on the same machine) and port 443 because a lot of firewalls won't block this port either so it has a high rate of success for connection. If you are sure the service is running, don't have the port blocked on the server or client side, then the next step would be to force the flash player to connect up over a specific port to see if it works. something like this:

nc.connect("rtmp://111.111.111.111:1935/myfirstapp/first_instance");

As you can see, I added :1935 on the end of the IP number. Just put in the port that you want to connect up on and are sure the server is listening on.

Now, on a quick side note that was also sent in the email, there is a way to create instances for applications from the admin panel. This is especially useful if you have code that needs to run on the server side before anybody connects up. Perhaps an initialization piece or a timer of some sorts. If you don't have an ASC files in the application directory, you might find this feature a bit useless and it may seem like it does nothing. It's doing something, but all it's doing is starting an instance of an application and running it. There aren't any connections to it and no code is running. By connecting up from an SWF file, you are doing the same thing really and the server will automatically create that instance for you. There aren't too many reasons why you would want to create an instance of an application before anybody connects up to it, but there are a few I guess.

Posted by: Graeme Bull on May 10, 2006

Share This Article

STi Chat for Wowza Media Server with Flex | Foundation Edition v4

STi Chat for Wowza Media Server with Flex | Foundation Edition v4

This is a new and improved basic video/audio/text chat application with the ability to invite other users to a private room. The Foundation Edition is meant to give developers the building blocks they need to learn, as well as an entry level solution for those needing a basic chat system. The source code is in AS3 and MXML with the Flex 4.5 SDK. We will be working on more features for the chat as we go and all are free.

$129 Buy Now