added -ip so you are able to specify which ip to bind the server
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
using MoonSharp.Interpreter;
|
||||
using System.Net;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
@@ -114,7 +115,7 @@ namespace Barotrauma.Networking
|
||||
private readonly int? ownerKey;
|
||||
private readonly UInt64? ownerSteamId;
|
||||
|
||||
public GameServer(string name, int port, int queryPort = 0, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10, int? ownKey = null, UInt64? steamId = null)
|
||||
public GameServer(string name, IPAddress listenIp, int port, int queryPort = 0, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10, int? ownKey = null, UInt64? steamId = null)
|
||||
{
|
||||
name = name.Replace(":", "");
|
||||
name = name.Replace(";", "");
|
||||
@@ -127,7 +128,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
LastClientListUpdateID = 0;
|
||||
|
||||
serverSettings = new ServerSettings(this, name, port, queryPort, maxPlayers, isPublic, attemptUPnP);
|
||||
serverSettings = new ServerSettings(this, name, port, queryPort, maxPlayers, isPublic, attemptUPnP, listenIp);
|
||||
KarmaManager.SelectPreset(serverSettings.KarmaPreset);
|
||||
serverSettings.SetPassword(password);
|
||||
|
||||
|
||||
+2
-1
@@ -37,7 +37,8 @@ namespace Barotrauma.Networking
|
||||
AutoExpandMTU = false,
|
||||
MaximumConnections = NetConfig.MaxPlayers * 2,
|
||||
EnableUPnP = serverSettings.EnableUPnP,
|
||||
Port = serverSettings.Port
|
||||
Port = serverSettings.Port,
|
||||
LocalAddress = serverSettings.ListenIPAddress
|
||||
};
|
||||
|
||||
netPeerConfiguration.DisableMessageType(NetIncomingMessageType.DebugMessage |
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
GamePort = (ushort)server.Port,
|
||||
QueryPort = isPublic ? (ushort)server.QueryPort : (ushort)0,
|
||||
Mode = isPublic ? Steamworks.InitServerMode.Authentication : Steamworks.InitServerMode.NoAuthentication
|
||||
Mode = isPublic ? Steamworks.InitServerMode.Authentication : Steamworks.InitServerMode.NoAuthentication,
|
||||
IpAddress = server.ServerSettings.ListenIPAddress
|
||||
};
|
||||
//options.QueryShareGamePort();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user