diff --git a/Server/Core/Networking/Server.cs b/Server/Core/Networking/Server.cs index 323ba67d..494c623c 100644 --- a/Server/Core/Networking/Server.cs +++ b/Server/Core/Networking/Server.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; +using System.Windows.Forms; +using xServer.Core.Data; using xServer.Core.Networking.Utilities; using xServer.Core.Packets; @@ -251,7 +253,7 @@ namespace xServer.Core.Networking { } } - + if (BufferManager == null) BufferManager = new PooledBufferManager(BUFFER_SIZE, 1) { ClearOnReturn = true }; @@ -268,6 +270,21 @@ namespace xServer.Core.Networking AcceptClient(null, _item); } } + catch (SocketException ex) + { + if (ex.ErrorCode == 10048) + { + MessageBox.Show("The port is already in use.", "Listen Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + MessageBox.Show( + string.Format( + "An unexpected socket error occurred: {0}\n\nError Code: {1}\n\nPlease report this as fast as possible here:\n{2}/issues", + ex.Message, ex.ErrorCode, Settings.RepositoryURL), "Unexpected Listen Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + Disconnect(); + } catch (Exception) { Disconnect(); diff --git a/Server/Forms/FrmReverseProxy.cs b/Server/Forms/FrmReverseProxy.cs index 2549d3a3..980c511d 100644 --- a/Server/Forms/FrmReverseProxy.cs +++ b/Server/Forms/FrmReverseProxy.cs @@ -62,14 +62,14 @@ namespace xServer.Forms { if (ex.ErrorCode == 10048) { - MessageBox.Show("The port is already in use.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("The port is already in use.", "Listen Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show( string.Format( "An unexpected socket error occurred: {0}\n\nError Code: {1}\n\nPlease report this as fast as possible here:\n{2}/issues", - ex.Message, ex.ErrorCode, Settings.RepositoryURL), "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + ex.Message, ex.ErrorCode, Settings.RepositoryURL), "Unexpected Listen Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } btnStop_Click(sender, null); } @@ -78,7 +78,7 @@ namespace xServer.Forms MessageBox.Show( string.Format( "An unexpected error occurred: {0}\n\nPlease report this as fast as possible here:\n{1}/issues", - ex.Message, Settings.RepositoryURL), "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + ex.Message, Settings.RepositoryURL), "Unexpected Listen Error", MessageBoxButtons.OK, MessageBoxIcon.Error); btnStop_Click(sender, null); } }