mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
feat: Enhance UDPServer initialization in Connect method
Updated the `Connect` method in `GenericUdpServer.cs` to include error handling for hostname parsing. The method now attempts to create a `UDPServer` instance with specified parameters and falls back to default initialization if an error occurs. This improves flexibility and robustness in server setup.
This commit is contained in:
@@ -194,7 +194,21 @@ namespace PepperDash.Core
|
||||
{
|
||||
if (Server == null)
|
||||
{
|
||||
Server = new UDPServer();
|
||||
try
|
||||
{
|
||||
var address = IPAddress.Parse(Hostname);
|
||||
|
||||
Server = new UDPServer(address, Port, BufferSize);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.LogError("Error parsing IP Address '{ipAddress}': message: {message}", Hostname, ex.Message);
|
||||
this.LogInformation("Creating UDPServer with default buffersize");
|
||||
|
||||
Server = new UDPServer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Hostname))
|
||||
|
||||
Reference in New Issue
Block a user