- Home /
UNet NetworkServer max connections
Is it possible to change number of max. connections for NetworkServer? It looks that the default value is 8.
When I am trying to setup it this way (e.g. with 100 connections):
ConnectionConfig config = new ConnectionConfig();
NetworkServer.Configure(config, 100);
then all clients throw error UNet Client Disconnect Error: CRC Mismatch.
Thanks for responses.
Answer by hMark · Sep 08, 2015 at 01:03 PM
Ok, finally I found fix. The issue was that client must have also attached connection config (dunno why). Then I needed to setup channels because config does not defined any.
server:
ConnectionConfig config = new ConnectionConfig();
config.AddChannel(QosType.ReliableSequenced);
config.AddChannel(QosType.Unreliable);
NetworkServer.Configure(config, MaxConnections);
NetworkServer.Listen(Port);
client:
client = new NetworkClient();
ConnectionConfig config = new ConnectionConfig();
config.AddChannel(QosType.ReliableSequenced);
config.AddChannel(QosType.Unreliable);
client.Configure(config, 1000);
client.Connect(IpAddress, Port);
Answer by glenwatkinson · Feb 08, 2017 at 04:10 PM
Was having the same issue but tried a different fix: enable advanced configuration in your network manager and set the maximum number of connections there. I couldn't add more than 8 players on a LAN game I'm developing until I made that change.
I'm running into this issue with 5.6.2f1. But I cannot go above 1 server and 6 clients. I changed the max connections to 15 and pushed that build to both my server and clients. But I still get the UNET Disconnect Error: No Resources issue.
Answer by LeopardX · Sep 07, 2015 at 03:48 AM
Hi @hMark Not sure if your using the new networking in unity 5, but you can also set the max connections on the NetworkManager..
Heres an example: using UnityEngine; using System.Collections; using UnityEngine.Networking;
public class StartServer : MonoBehaviour {
string HostName = "127.0.0.1";
// Starts the server as host
public void _StartupHost()
{
NetworkManager.singleton.networkPort = 7777;
NetworkManager.singleton.maxConnections = 50;
NetworkManager.singleton.StartHost ();
}
// Connects to the server as a client
public void _JoinWorld()
{
NetworkManager.singleton.networkAddress = HostName;
NetworkManager.singleton.networkPort = 7777;
NetworkManager.singleton.StartClient ();
}
}
same problem (number of connections is still 8). the only difference is that it does not throw error with your code
Answer by PaulosCreations · May 17, 2016 at 12:57 PM
Only on the Server :
manager = GetComponent<NetworkManager>();
var config = new ConnectionConfig();
config.AddChannel(QosType.Reliable);
config.AddChannel(QosType.Unreliable);
manager.StartServer(config, maxConnections);
Client needs nothing other than :
manager = GetComponent<NetworkManager>();
manager.StartClient();
Assuming you are using or are deriving from the NetworkManager.
Your answer
Follow this Question
Related Questions
Unet NetworkServer.Spawn() not working 5 Answers
unity networking not working,Unity networking not working 0 Answers
UNET Direct IP Connection not working 0 Answers
UNET "no free events for message" when client pauses game. 2 Answers
Unity network perfomance 0 Answers