mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
Port type changed from int to ushort everywhere so we don't need the 0 <= port <= 65535 check anymore
This commit is contained in:
parent
7463e0d811
commit
a94b56ae66
@ -17,10 +17,8 @@ public class NetworkClient
|
||||
|
||||
public static bool pauseMessageHandling;
|
||||
|
||||
int m_HostPort;
|
||||
|
||||
string m_ServerIp = "";
|
||||
int m_ServerPort;
|
||||
ushort m_ServerPort;
|
||||
int m_ClientId = -1;
|
||||
|
||||
readonly Dictionary<short, NetworkMessageDelegate> m_MessageHandlers = new Dictionary<short, NetworkMessageDelegate>();
|
||||
@ -41,24 +39,11 @@ internal void SetHandlers(NetworkConnection conn)
|
||||
}
|
||||
|
||||
public string serverIp { get { return m_ServerIp; } }
|
||||
public int serverPort { get { return m_ServerPort; } }
|
||||
public ushort serverPort { get { return m_ServerPort; } }
|
||||
public ushort hostPort;
|
||||
public NetworkConnection connection { get { return m_Connection; } }
|
||||
|
||||
public Dictionary<short, NetworkMessageDelegate> handlers { get { return m_MessageHandlers; } }
|
||||
public int hostPort
|
||||
{
|
||||
get { return m_HostPort; }
|
||||
set
|
||||
{
|
||||
if (value < 0)
|
||||
throw new ArgumentException("Port must not be a negative number.");
|
||||
|
||||
if (value > 65535)
|
||||
throw new ArgumentException("Port must not be greater than 65535.");
|
||||
|
||||
m_HostPort = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool isConnected { get { return connectState == ConnectState.Connected; } }
|
||||
|
||||
@ -87,7 +72,7 @@ public NetworkClient(NetworkConnection conn)
|
||||
RegisterSystemHandlers(false);
|
||||
}
|
||||
|
||||
public void Connect(string serverIp, int serverPort)
|
||||
public void Connect(string serverIp, ushort serverPort)
|
||||
{
|
||||
PrepareForConnect();
|
||||
|
||||
|
@ -17,7 +17,7 @@ public enum PlayerSpawnMethod
|
||||
public class NetworkManager : MonoBehaviour
|
||||
{
|
||||
// configuration
|
||||
[FormerlySerializedAs("m_NetworkPort")] public int networkPort = 7777;
|
||||
[FormerlySerializedAs("m_NetworkPort")] public ushort networkPort = 7777;
|
||||
[FormerlySerializedAs("m_ServerBindToIP")] public bool serverBindToIP;
|
||||
[FormerlySerializedAs("m_ServerBindAddress")] public string serverBindAddress = "";
|
||||
[FormerlySerializedAs("m_NetworkAddress")] public string networkAddress = "localhost";
|
||||
@ -232,7 +232,7 @@ internal void RegisterClientMessages(NetworkClient client)
|
||||
}
|
||||
}
|
||||
|
||||
public NetworkClient StartClient(int hostPort=0)
|
||||
public NetworkClient StartClient(ushort hostPort=0)
|
||||
{
|
||||
InitializeSingleton();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user