Network.InitializeServer not opening port

I'm really trying to understand how to set up a stand-alone server for an online multiplayer game. The doc says "simply" ...

So I gave up on trying to make a stand-alone server for now and created a server script and attached it to an object:

Initialize ();

function Initialize () {
    print ("listening");
    Network.incomingPassword = "bigfatcat";
    Network.InitializeServer (32, 25000, false);

function OnServerInitialized () {
    print ("server initialized");

function OnPlayerConnected (player : NetworkPlayer) {
    print ("player connected from " + player.ipAddress + ":" + player.port);

function OnPlayerDisconnected (player : NetworkPlayer) {
    print ("player disconnected " + player.ipAddress + ":" + player.port);

The console window shows the "listening" and "server initialized" messages. Yet "netstat -a -n" doesn't show anything listening on port 25000 (neither TCP nor UDP). Should it? I am assuming Network.InitializeServer() does the socket(), bind() and listen() calls, correct?

I also created a simple client script in the same scene with this script:

var count = 0;
var connected = false;

Initialize ();

function Initialize () {

function OnFailedToConnectToMasterServer (error : NetworkConnectionError) {
    print ("failed to connect to master server: "+ error);

function OnFailedToConnect (error : NetworkConnectionError) {
    print ("failed to connect: " + error);

function OnConnectedToServer () {
    print ("connected to server!");
    connected = true;

function Update () {
    count ++;
    if (count < 10) {
        print ("count " + count);
    } else if (count == 10) {
        print ("starting to connect");
        Network.Connect ("", 25000, "bigfatcat");
    } else if (connected) {
        count ++;
        print ("test2 rotating: " + count);
        transform.Rotate(3*Time.deltaTime, 4*Time.deltaTime, 5*Time.deltaTime);

The console gets "count 1...9" then "starting to connect". After a few seconds, it says "The connection request to failed. Are you sure the server can be connected to?" and "failed to connect: ConnectionFailed".

Any ideas why it doesn't work?

Also, I would like the server script to run all by itself from the command line. How do I do that?


Well, just to be sure i've tested it with our game and i get this line in Netstat:


I'm not sure what is going wrong with your server. Just another hint: you have to start 2 versions of your application. You can't be server and client in one game instance. So create a build or start unity 2 times. It seems you try to act as both: server and client. That's not possible. If you use connect i'm quite sure that the server gets closed. The Network interface can only operate as server OR client not both.

I’m having the exact same problem, except that I’m running my application in 2 different machines. One hosts, and the other connects, both to the port 25000 and giving me the same error you were getting.

The machines are in a LAN, without router, so it’s not a port forward problem. Any guess?