Click here to Skip to main content
16,018,650 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can i declare a global variable which can be used in the multiple projects Pin
Urs Enzler7-Aug-07 22:24
Urs Enzler7-Aug-07 22:24 
QuestionGetting the Name of the Method Which Invoked the Current Method Pin
vvijaykrishna7-Aug-07 20:10
vvijaykrishna7-Aug-07 20:10 
AnswerRe: Getting the Name of the Method Which Invoked the Current Method Pin
originSH7-Aug-07 22:53
originSH7-Aug-07 22:53 
QuestionC# Colorizer for HTML Code Pin
Michael Sync7-Aug-07 20:02
Michael Sync7-Aug-07 20:02 
AnswerRe: C# Colorizer for HTML Code Pin
Paul Conrad12-Aug-07 6:42
professionalPaul Conrad12-Aug-07 6:42 
GeneralRe: C# Colorizer for HTML Code Pin
Michael Sync12-Aug-07 15:02
Michael Sync12-Aug-07 15:02 
QuestionConnecting Exchange 2003 Server Pin
Pratik Vasant Shah7-Aug-07 19:57
Pratik Vasant Shah7-Aug-07 19:57 
QuestionC# Socket issue Pin
dotman17-Aug-07 19:04
dotman17-Aug-07 19:04 
I am having difficulty filtering IP Addresses using IPAddress.TryParse()

I am trying to get upto speed with .NET programming, running MSVS 2005 .NET on Vista Home Pro.
System Config Notebook one ethernet + built-in WiFi.

On form load I request Internet Host Info and aquire numerous addresses, and add them to the listbox for selection
later.

The problem some do not reflect a true IP address are varied lengths some look like partial mac adresses etc, and are invalid for speific reasons hense the need to filter them.

Having stepped through debug I am now assuming the reason IPAddress.TryParse() is not filtering them is because the values are valid based on the AddressList[] static members:

Any, Broadcast, IPv6Any ... the list continues. Identifying IPv6Loopback as being the problem for the following scenario because IPv6Loopback contains {::1}

For simplicity, with no ethernet connection & WiFi disabled; I have 2 items in the listbox:

::1 (I regard as a problem)
127.0.0.1 (Loopback no problem)

The code:

string strIP = null;

IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
if (hostEntry.AddressList.Length > 0)
{
foreach (IPAddress ip in hostEntry.AddressList)
{
strIP = ip.ToString();
IPAddress tmpAddress;

if (IPAddress.TryParse(strIP, out tmpAddress))
{
socketListBox.Items.Add(strIP);
}
}
}


If my assumtion is correct how can I filter the items which cause phyical issues.

Regards

dotman1

AnswerRe: C# Socket issue Pin
Hessam Jalali7-Aug-07 20:12
Hessam Jalali7-Aug-07 20:12 
GeneralRe: C# Socket issue Pin
dotman17-Aug-07 22:31
dotman17-Aug-07 22:31 
GeneralRe: C# Socket issue Pin
originSH7-Aug-07 22:55
originSH7-Aug-07 22:55 
GeneralRe: C# Socket issue Pin
dotman17-Aug-07 23:04
dotman17-Aug-07 23:04 
QuestionPlay Many mpg simultaneously Pin
alayle7-Aug-07 18:13
alayle7-Aug-07 18:13 
AnswerRe: Play Many mpg simultaneously Pin
Christian Graus7-Aug-07 18:14
protectorChristian Graus7-Aug-07 18:14 
QuestionPreview Files Pin
_Arthur7-Aug-07 18:12
_Arthur7-Aug-07 18:12 
AnswerRe: Preview Files Pin
Christian Graus7-Aug-07 18:15
protectorChristian Graus7-Aug-07 18:15 
GeneralRe: Preview Files Pin
_Arthur7-Aug-07 19:12
_Arthur7-Aug-07 19:12 
GeneralRe: Preview Files Pin
ekynox7-Aug-07 19:18
ekynox7-Aug-07 19:18 
QuestionTimer in C# Pin
mimimimilaw7-Aug-07 18:03
mimimimilaw7-Aug-07 18:03 
AnswerRe: Timer in C# Pin
Christian Graus7-Aug-07 18:13
protectorChristian Graus7-Aug-07 18:13 
AnswerRe: Timer in C# Pin
Developer6117-Aug-07 22:17
Developer6117-Aug-07 22:17 
GeneralRe: Timer in C# Pin
Luc Pattyn7-Aug-07 23:36
sitebuilderLuc Pattyn7-Aug-07 23:36 
Questionstart a form maximized? [modified] Pin
sudany_zool7-Aug-07 17:50
sudany_zool7-Aug-07 17:50 
AnswerRe: start a form maximized? Pin
Christian Graus7-Aug-07 18:16
protectorChristian Graus7-Aug-07 18:16 
QuestionError on ISynchronizeInvoke casting Pin
jacklynn_mei7-Aug-07 16:32
jacklynn_mei7-Aug-07 16:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.