diff --git a/src/d_enet.c b/src/d_enet.c
index eaba4c3544263eca53f99d86fd2a88ef221d357b..5920361c16565ff528ce90d4f76878563f1d9e40 100644
--- a/src/d_enet.c
+++ b/src/d_enet.c
@@ -11,6 +11,7 @@
 #include "p_local.h"
 #include "d_main.h"
 #include "i_system.h"
+#include "m_argv.h"
 
 UINT8 net_nodecount, net_playercount;
 UINT8 playernode[MAXPLAYERS];
@@ -21,6 +22,7 @@ boolean nodeingame[MAXNETNODES]; // set false as nodes leave game
 
 #define MAX_SERVER_MESSAGE 320
 
+static UINT16 portnum = 5029;
 static tic_t lastMove;
 static ticcmd_t lastCmd;
 
@@ -410,7 +412,7 @@ void Net_AckTicker(void)
 
 void D_NetOpen(void)
 {
-	ENetAddress address = { ENET_HOST_ANY, 5029 };
+	ENetAddress address = { ENET_HOST_ANY, portnum };
 	ServerHost = enet_host_create(&address, MAXNETNODES, NET_CHANNELS, 0, 0);
 	if (!ServerHost)
 		I_Error("ENet failed to open server host. (Check if the port is in use?)");
@@ -461,22 +463,16 @@ boolean D_NetConnect(const char *hostname, const char *port)
 }
 
 // Initialize network.
-// Returns true if the server is booting up right into a level according to startup args and whatnot.
 // netgame is set to true before this is called if -server was passed.
-boolean D_CheckNetGame(void)
+void D_CheckNetGame(void)
 {
 	if (enet_initialize())
 		I_Error("Failed to initialize ENet.\n");
-	if (netgame)
-	{
-		if (server)
-			D_NetOpen();
-	}
-	else
-		server = true;
-	multiplayer = netgame;
+
+	if ((M_CheckParm("-port") || M_CheckParm("-udpport")) && M_IsNextParm())
+		portnum = (UINT16)atoi(M_GetNextParm());
+
 	D_ClientServerInit();
-	return netgame;
 }
 
 void D_CloseConnection(void)
diff --git a/src/d_enet.h b/src/d_enet.h
index 306ddb64fef58f05748a8e1d66dd9c292ca12f72..bf53168d2693fae08fb69ea12b39208a3c1fafe4 100644
--- a/src/d_enet.h
+++ b/src/d_enet.h
@@ -13,7 +13,7 @@ boolean D_NetConnect(const char *hostname, const char *port);
 
 boolean Net_GetNetStat(void);
 void Net_AckTicker(void);
-boolean D_CheckNetGame(void);
+void D_CheckNetGame(void);
 void D_CloseConnection(void);
 void Net_CloseConnection(INT32 node);
 
diff --git a/src/d_main.c b/src/d_main.c
index 474ef4424e23913fae181d468c850bde3e8358cb..dec9b77960145c21d7c00a36b2e5cebbd55ab643 100644
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1207,8 +1207,7 @@ void D_SRB2Main(void)
 
 	// init all NETWORK
 	CONS_Printf("D_CheckNetGame(): Checking network game status.\n");
-	if (D_CheckNetGame())
-		autostart = true;
+	D_CheckNetGame();
 
 	// check for a driver that wants intermission stats
 	// start the apropriate game based on parms