Search Unity

Super Noob question

Discussion in 'Multiplayer' started by bigkahuna, Aug 25, 2008.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Real noob question here: I'm trying to run the Unity networking example project. I've got Unity running on two machines that are networked through a router. I launched the "Car Racing" scene on both Macs.

    On one Mac, I clicked on "Start Server" using the default settings. On the other Mac I clicked on "Connect" using the default settings (127.0.0.1 / 25001). The "client" Mac displays this:

    Code (csharp):
    1. Running as client.  No player ID set yet.  UnityEngine.Network.Connect(String, Int32)
    Then after a few seconds this:

    Code (csharp):
    1. The connection request to 127.0.0.1:25001 failed.  Are you sure the server can be connected to?
    Ok, what am I doing wrong? Both Macs can connect to the Internet, share files and "Teleport" works (an app that shares my mouse / keyboard across a network... BTW I turned "Teleport" off for this test).
     
  2. Timmer

    Timmer

    Joined:
    Jul 28, 2008
    Posts:
    330
    127.0.0.1 is the loopback, or local computer, address. It says "Connect to myself" no matter where you are.

    So the client is trying to find a server on itself, which, of course is not running a server.

    To do what you're doing you need to find the IP address of your server computer. Open a Terminal and type 'ifconfig' and look for an IP address. (Since I'm not at a Mac and OS X uses a different interface id system than I'm used to I can't give advice under which heading but if you read through it all you should be able to find it.)

    Hope that helps!
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I tried that. I found the server's IP address through the OS X System Preferences (something like 192.xxx.x.xxx) panel and tried using that address on the client application, but the same thing happened.
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Ah, come on, nobody knows how to make this work? I switched to a simple airport network (to avoid going through the router). I confirmed that the network is working by pinging the MBP's IP from my iMac and visa versa. So my two Macs are networked, but when I try to run any of the networking demos it won't work. Argh... What am I missing?
     
  5. larus

    larus

    Unity Technologies

    Joined:
    Oct 12, 2007
    Posts:
    280
    Check your firewall settings on the machine running as server, check if it has only essential services allowed, or only specific applications. If its set like that then you could test by allowing all incoming connections.
     
  6. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks larus. I turned off firewall on both computers, still no connection. :( Here's how I've set it up:

    iMac and MBP networked via Airport.
    I turned off the firewalls on both computers.
    I checked both computers' IP address in the system preferences under TCIP settings
    I opened a terminal window and pinged the iMac from the MBP and visa versa. It worked fine so that verifies that the two are networked and talking.
    I launched a copy of the Unity editor in both computers, then I launched one of the network demo scenes (I think I've tried them all).
    I set the iMac's IP address in the IP address text box in the running game view, and then clicked on "start server".
    Then on the MBP I put the iMac's IP address in the IP address text box in a running game view, and then clicked on "connect".
    After a couple seconds I get the error messages shown in my first post... argh :evil:

    I've never been able to get network games to work locally (although when people post demos on the internet, I've been able to play them). Can anyone help? I'm sure there's just something extremely simple / stupid that I'm not getting here...
     
  7. Marc

    Marc

    Joined:
    Oct 4, 2007
    Posts:
    499
    Can both machines ping each other?
     
  8. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
  9. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Sorted. Needed to set each system to a unique port. :roll: