473,327 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Dns.GetHostAddresses()

so im pulling a list of computer names from the AD.. and then for each name
im doing a DNS lookup to get the IP... the problem is that apparently not
all of the names in the AD are in DNS... which is expected, and fine.. the
problem is that if the host isnt found the method pukes... and im not really
sure why this is... i guess i can toss a try/catch around it.. but is there
some better way to handle this?

Thanks
Justin
Sep 11 '07 #1
2 5027
Justin Rich wrote:
so im pulling a list of computer names from the AD.. and then for each name
im doing a DNS lookup to get the IP... the problem is that apparently not
all of the names in the AD are in DNS... which is expected, and fine.. the
problem is that if the host isnt found the method pukes... and im not really
sure why this is... i guess i can toss a try/catch around it.. but is there
some better way to handle this?
The normal way to handle this would be try/catching the GetHostAddresses
call.

Chris.
Sep 11 '07 #2
On Sep 11, 11:39 am, "Justin Rich" <jrich...@yahoo.spam.comwrote:
so im pulling a list of computer names from the AD.. and then for each name
im doing a DNS lookup to get the IP... the problem is that apparently not
all of the names in the AD are in DNS... which is expected, and fine.. the
problem is that if the host isnt found the method pukes... and im not really
sure why this is... i guess i can toss a try/catch around it.. but is there
some better way to handle this?
The underlying WSA functions have errors that are mapped into
SocketExceptions. Due to the fact that one of the underlying errors
of a gethostbyname function (which is ultimately the WSA function
called) is WSA_HOST_NOT_FOUND, you will get a SocketException whenever
this error occurs. This is the behavior, so wrap your call with a try/
catch SocketException block.

Sep 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: John J. Hughes II | last post by:
I have a service that needs to send e-mail alerts. I have been attempting to use the System.Net.Mail function from .NET but this seems to require the IIS be installed and running. Since some of...
2
by: Tim | last post by:
Hi, I was wondering if anyone knows how to get the external IP address (the address beyond the router ) using C# code? Basically this is the address that appears on the internet. Thanks Tim
13
by: Sandeep Singh | last post by:
I am making socket client application in C# how can i get ip address of client who has connected to server
2
by: Terry Olsen | last post by:
I am using VB 2005. I can't seem to find a way to get my local Subnet Mask. The only thing mentioned from googling is the GetIpAddrTable API, but so far, i've had no luck getting a call to it...
8
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all comments and help. I have an application that an Administrator might use. I'm trying to figure out how to programatically get the local Machine LAN IP addres....
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
9
by: Mark Rae | last post by:
Hi, Now that the VS.NET 2005 SP1 update patch is with us, I'm in the process of moving my main development environment onto 64-bit Vista Business Edition - so far, so good... However, there...
1
by: Joey | last post by:
asp.net 2/C#/VS2005 Does anyone know why "Request.UserIPAddress" returns an empty IPV6 address when I run (both serve and browse) my asp.net app on Windows Vista? It all works fine on Windows XP...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.