Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity Networking - How to determine if NetworkServer is not listening on port.

Discussion in 'Multiplayer' started by LukasO, Feb 1, 2016.

  1. LukasO

    LukasO

    Joined:
    May 23, 2013
    Posts:
    115
    I know this issue can sometimes crop up especially when testing on the same network:

    Cannot open socket on ip {*} and port {47775}; check please your network, most probably port has been already occupied

    But when you run the function it ALWAYS returns true. I basically want to make an error message on screen if this error happens but I can't determine a way of doing it.

    Any suggestions?

    Thanks,
     
  2. LukasO

    LukasO

    Joined:
    May 23, 2013
    Posts:
    115
    I forgot to mention the fundtion I'm talking about:

    Code (CSharp):
    1. NetworkServer.Listen(47775)
     
  3. asperatology

    asperatology

    Joined:
    Mar 10, 2015
    Posts:
    981
    Have you tested this on other ports, especially on ports you are very certain it is closed? If yes, and you see closed ports as open, you might as well submit a bug report about it.
     
  4. LukasO

    LukasO

    Joined:
    May 23, 2013
    Posts:
    115
    Yes absolutely. I get the warning! The problem I suspect though is that it has still completed the function and set it the architecture it needed for the network game itself, it just can't listen. I'll submit a bug report and see if there's any suggestions.