Search Unity

host id out of bound id {0} max id should be greater 0 and less than {0}

Discussion in 'Multiplayer' started by dalanchoo, May 22, 2017.

  1. dalanchoo

    dalanchoo

    Joined:
    Jun 6, 2014
    Posts:
    44
    Hi everybody. I recently started getting this error message when I run my project.

    host id out of bound id {0} max id should be greater 0 and less than {0}

    The code that generated this error worked fine on version 5.3.5f1 but once I upgraded to 5.6.0f3 this error has appeared. I have also tried 5.6.1.f1 but the error persists.

    This error happens in a program that uses the lower level API as a server. I get this error when running the program alone, with no clients trying to connect.

    This is the snippet of code where the error actually happens.

    bool CheckSocketForData(SocketConnection currSocket)
    {
    Assert.IsNotNull(currSocket);


    int maxMessageLen = 1024; // JLTODO

    int recConnectionId;
    int recChannelId;
    byte[] recBuffer = new byte[maxMessageLen];
    int dataSize;
    byte error;
    string message;

    NetworkEventType recNetworkEvent = NetworkTransport.ReceiveFromHost(currSocket.socketId, out recConnectionId, out recChannelId, recBuffer, maxMessageLen, out dataSize, out error);


    And the socket is created by the code CreateHostSocket

    public static SocketConnection CreateHostSocket(string name, int port)
    {
    HostTopology topology;
    var socket = CreateSocketCommon(name, out topology);

    socket.socketId = NetworkTransport.AddHost(topology, port);
    return socket;
    }


    static SocketConnection CreateSocketCommon(string name, out HostTopology topology)
    {
    var socket = new SocketConnection(name);

    ConnectionConfig config = new ConnectionConfig();
    socket.reiliableChannelId = config.AddChannel(QosType.Reliable);
    socket.unreliableChannelId = config.AddChannel(QosType.Unreliable);

    topology = new HostTopology(config, 10);
    return socket;
    }


    Any ideas how to proceed?

    Thank You
    John Lawrie
     
  2. modalJohn

    modalJohn

    Joined:
    May 4, 2017
    Posts:
    1