[ 
https://issues.apache.org/jira/browse/LOG4NET-112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920149#action_12920149
 ] 

Marc Borgers commented on LOG4NET-112:
--------------------------------------

The problem is located in a the routine that does the conversion from hostname 
to the ipaddress in IPAddressConverter TryParse does not work.

Here is what I did and what seems to work.  I replaced the callback with my own 
to work around the proble:

                public object ConvertFrom(object source) 
                {
                        string str = source as string;
                        if (str != null && str.Length > 0) 
                        {
                                try
                                {
                                        // It seems that TryParse, used in the 
Log4Net code does not work
                                        if 
(str.Trim(validIpAddressChars).Length == 0)
                                        {
                                                try
                                                {
                                                        // try to parse the 
string as an IP address
                                                        return 
IPAddress.Parse(str);
                                                }
                                                catch(FormatException)
                                                {
                                                        // Ignore a 
FormatException, try to resolve via DNS
                                                }
                                        }

                                        // Try to resolve via DNS. This is a 
blocking call.
                                        IPHostEntry host = 
Dns.GetHostByName(str);
                                        if (host != null && 
                                                host.AddressList != null && 
                                                host.AddressList.Length > 0 &&
                                                host.AddressList[0] != null)
                                        {
                                                return host.AddressList[0];
                                        }
                                }
                                catch(Exception ex)
                                {
                                        throw 
ConversionNotSupportedException.Create(typeof(IPAddress), source, ex);
                                }
                        }
                        throw 
ConversionNotSupportedException.Create(typeof(IPAddress), source);
                }


> Add support to the UdpAppender for IP v6 remote addresses
> ---------------------------------------------------------
>
>                 Key: LOG4NET-112
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-112
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Appenders
>    Affects Versions: 1.2.10
>            Reporter: Nicko Cadell
>            Assignee: Nicko Cadell
>            Priority: Minor
>             Fix For: 1.2.11
>
>
> The UdpClient object must be configured for either IP v4 or IP v6 when it is 
> created. Once configured it cannot be used to send to remote addresses that 
> are from a different network family.
> Specifying the network family is not supported on NET 1.0, NETCF 1.0, SSCLI 
> 1.0

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to