Search Unity

NetworkDriver.Bind "Failed to bind to port 9000, code 10048" on custom Worlds initialization.

Discussion in 'Multiplayer' started by Xytabich, Mar 17, 2020.

  1. Xytabich

    Xytabich

    Joined:
    Jan 20, 2014
    Posts:
    4
    When creating the project, a separation of the server and client world was needed. For this, the IServerWorld and IClientWorld interfaces were created.
    Then DefaultWorldInitialization was copied and interface filtering was added. This prevents the addition of server systems to the client.
    But after that, NetworkDriver.Bind stopped working, giving error 10048. As I understand it, the error occurs due to the use of a port in the system, but netstat did not show that this port is being used.
    However, when using DefaultWorldInitialization, the binding works fine and there are no errors.

    What does a network system need for normal work?

    Server initialization code:
    Code (CSharp):
    1. serverDriver = NetworkDriver.Create(new ReliableUtility.Parameters { WindowSize = 32 });
    2. reliablePipeline = serverDriver.CreatePipeline(typeof(ReliableSequencedPipelineStage));
    3. unreliablePipeline = serverDriver.CreatePipeline(typeof(UnreliableSequencedPipelineStage));
    4.  
    5. var addr = NetworkEndPoint.AnyIpv4;
    6. addr.Port = 9000;
    7.  
    8. int code = serverDriver.Bind(addr);
    9. if(code != 0) Debug.LogFormat("Failed to bind to port {0}, code {1}", addr.Port, code);
    10. else serverDriver.Listen();
    Initialization of the worlds going on in WorldsInit. WorldInitSystem - custom initialization of the world.
     

    Attached Files:

    Last edited: Mar 18, 2020
    onefaceoneface likes this.