Search Unity

Setting up Server and Client apps on one computer?

Discussion in 'Multiplayer' started by bigkahuna, Oct 20, 2008.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    My networked Unity application works fine when running the Server app on one computer, and the Client on another (and through a router). Now I'd like to be able to run both on one computer and the client isn't connecting. I'm setting the IP manually on the client using the same IP I would use if it were networked and I'm guessing that's my problem. How do I get this to work?
     
  2. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Personally, I'm using the MasterServer for this, and it's "just working out of the box". I'd assume you'd have to correctly set the ports for this to work. So you'd simply assign two different ports, one for the server, and one for the client - and the IP-addresses would be the same.

    In general, even though it takes a little more time to set it up when starting, I think using the MasterServer simplifies things enough to be worth that.
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    My particular application will only be used by two players, one on the "server" app and the other on the "client" app, so not your typical "multi-player" game.

    I'm trying that and the client isn't connecting. I built the server app to a stand-alone and the client is running in the editor. I'm using the same IP as what I would use if they were connected through a router (ie. 192.xxx.0.100). I also tried 127.0.0.0 and that also didn't seem to work. Any ideas?
     
  4. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Unfortunately not. When I'm doing this with the MasterServer, I think I'm getting the local router addresses (with different ports), so that *should* work. Also, having one app in the editor and one as standalone shouldn't be a problem.

    You've probably already tried all combinations? Might be something just screwed up somewhere in the configuration - but aside of IP-addresses and ports I couldn't think of anything else to configure there.
     
  5. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I got it sorted. For future reference, the correct IP is 127.0.0.1. I didn't see that it was working when I first tried it because I didn't have "allow to run in background" on. :oops:
     
  6. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    933
    "localhost" will always resolve to 127.0.0.1, and is a little easier to remember.
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks, I'll remember that!