Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Which port to use?

Discussion in 'Multiplayer' started by yoonitee, Apr 12, 2014.

  1. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    When connecting to the Master Server etc. or any networking which port should I use?

    Is it always port 25000? What happens if this is in use from another application? If that is the case can you test if the port is already in use?

    Sometimes when testing my game I get the error "Can't connect, port may already be in use"?

    I don't really know what a port is exactly!! In some Unity examples they use port 25000 and some they use port 25001.

    I'm worried that if someone downloads my game and they already have port 25000 in use, they won't be able to play my game! (I start a server even for single player games because then it can use RPC functions!)
     
  2. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
    The idea that you will release a game (even for testing) that you can't support yourself sounds akward to me....
    Maybe it's time to start learning ?
     
  3. JamesElvin

    JamesElvin

    Joined:
    Sep 19, 2013
    Posts:
    33
    When I use hamachi to test multiplayer projects that I create, I use the port number 25565 and I have used various random ports so I don't see any problem with using any other port that is not in use. There are a large amount of ports so it shouldn't really matter, but don't take my word for it.
     
  4. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    OK. That's what I'm doing here. Learning. So you don't know the answer either?
     
  5. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
  6. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    I read the whole thing and where does it say whether two applications can use the same port to transfer data? I was hoping someone on this forum would know the answer.
     
  7. appels

    appels

    Joined:
    Jun 25, 2010
    Posts:
    2,687
  8. MyCatFishSteve

    MyCatFishSteve

    Joined:
    Jan 13, 2013
    Posts:
    55
    Alrighty, lets put it into imagery

    Imagine your router as a house
    Inside you house there is a party (game server)
    Your house has 1000's of doors but only the ones you want to be open...
    When players put your IP address, that is your street address and house number,
    The port is which door to use to access your party

    Other people have their homes with partys inside them, and they chose what doors are open in their house

    You cannot have two party's using the same door or else they will lead to the same party (Paradox ;3)
     
  9. yoonitee

    yoonitee

    Joined:
    Jun 27, 2013
    Posts:
    2,363
    But can you have 2 parties in the same house?