I have the following code:
Dim IP, domainName As String
domainName = "yahoo.com"
Try
IP = System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring()
Catch ex As Exception
IP = "Not Valid"
End Try
Console.WriteLi ne(IP)
System.Threadin g.Thread.Sleep( 2000)
When it has a resolvable domain, like yahoo.com it responds back instantly
with the ip address. However, if there is a domain in there that does not
exist, like blue2343.com, it takes upwards of 5 seconds to print "Not Valid"
to the screen. Why is that? and is there a way around it?
Thanks,
Scott
Nov 20 '05
22 1561
Scot,
What happens when you step into the code? Does it takes this long everytime
you run the app, even if the process is not recycled? Charles is saying "I
have noticed that the first time an exception is thrown and caught, a .NET
application can take a significant time (several seconds) before returning
control to the catch block." Have you confirmed this is what is happening
by stepping into the try...catch block?
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message
news:c5******** @library1.airne ws.net... I think Charles is correct in his assumption. I understand that DNS
lookups on non-existant domains take longer, but not in the 3 to 5 second range.
A second or two would be acceptable, but even that would be long if you
there was minimal network latency.
I believe it is something in the Try..Catch segment. Anyone? "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:Oq******** *****@tk2msftng p13.phx.gbl... Scot,
This is mostly likely due to the time it is taking for your DNS server
to attempt to resolve the DNS name to an IP address. It is not uncommon
for 3-6 seconds to pass while DNS attempts to resolve an entry that does not exist. There is no way around the time it takes for a DNS server to exhaust its resources in an attempt to resolve hostnames to ip addresses.
HTH,
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... I have the following code:
Dim IP, domainName As String domainName = "yahoo.com"
Try IP = System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring() Catch ex As Exception IP = "Not Valid" End Try
Console.WriteLi ne(IP) System.Threadin g.Thread.Sleep( 2000)
When it has a resolvable domain, like yahoo.com it responds back instantly with the ip address. However, if there is a domain in there that does not exist, like blue2343.com, it takes upwards of 5 seconds to print "Not
Valid" to the screen. Why is that? and is there a way around it?
Thanks,
Scott
I haven't tried that. Unfortunately I am not an "official" programmer, so I
more or less hack things together until they work. I wouldn't have even the
first bit of a clue as far as how to step into the try....catch block. In
fact this is the first time I have ever used one in vb.net, and it was only
because I couldn't solve the situation another way.
It takes this long everytime I run the app, but it is started from scratch
each time.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:eU******** ******@TK2MSFTN GP11.phx.gbl... Scot,
What happens when you step into the code? Does it takes this long
everytime you run the app, even if the process is not recycled? Charles is saying
"I have noticed that the first time an exception is thrown and caught, a .NET application can take a significant time (several seconds) before returning control to the catch block." Have you confirmed this is what is happening by stepping into the try...catch block?
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... I think Charles is correct in his assumption. I understand that DNS lookups on non-existant domains take longer, but not in the 3 to 5 second range. A second or two would be acceptable, but even that would be long if you there was minimal network latency.
I believe it is something in the Try..Catch segment. Anyone? "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in
message news:Oq******** *****@tk2msftng p13.phx.gbl... Scot,
This is mostly likely due to the time it is taking for your DNS server to attempt to resolve the DNS name to an IP address. It is not uncommon for 3-6 seconds to pass while DNS attempts to resolve an entry that does
not exist. There is no way around the time it takes for a DNS server to exhaust its resources in an attempt to resolve hostnames to ip addresses.
HTH,
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... > I have the following code: > > Dim IP, domainName As String > domainName = "yahoo.com" > > Try > IP = System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring() > Catch ex As Exception > IP = "Not Valid" > End Try > > Console.WriteLi ne(IP) > System.Threadin g.Thread.Sleep( 2000) > > > When it has a resolvable domain, like yahoo.com it responds back instantly > with the ip address. However, if there is a domain in there that
does not > exist, like blue2343.com, it takes upwards of 5 seconds to print
"Not Valid" > to the screen. Why is that? and is there a way around it? > > Thanks, > > Scott > >
I haven't tried that. Unfortunately I am not an "official" programmer, so I
more or less hack things together until they work. I wouldn't have even the
first bit of a clue as far as how to step into the try....catch block. In
fact this is the first time I have ever used one in vb.net, and it was only
because I couldn't solve the situation another way.
It takes this long everytime I run the app, but it is started from scratch
each time.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:eU******** ******@TK2MSFTN GP11.phx.gbl... Scot,
What happens when you step into the code? Does it takes this long
everytime you run the app, even if the process is not recycled? Charles is saying
"I have noticed that the first time an exception is thrown and caught, a .NET application can take a significant time (several seconds) before returning control to the catch block." Have you confirmed this is what is happening by stepping into the try...catch block?
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... I think Charles is correct in his assumption. I understand that DNS lookups on non-existant domains take longer, but not in the 3 to 5 second range. A second or two would be acceptable, but even that would be long if you there was minimal network latency.
I believe it is something in the Try..Catch segment. Anyone? "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in
message news:Oq******** *****@tk2msftng p13.phx.gbl... Scot,
This is mostly likely due to the time it is taking for your DNS server to attempt to resolve the DNS name to an IP address. It is not uncommon for 3-6 seconds to pass while DNS attempts to resolve an entry that does
not exist. There is no way around the time it takes for a DNS server to exhaust its resources in an attempt to resolve hostnames to ip addresses.
HTH,
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... > I have the following code: > > Dim IP, domainName As String > domainName = "yahoo.com" > > Try > IP = System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring() > Catch ex As Exception > IP = "Not Valid" > End Try > > Console.WriteLi ne(IP) > System.Threadin g.Thread.Sleep( 2000) > > > When it has a resolvable domain, like yahoo.com it responds back instantly > with the ip address. However, if there is a domain in there that
does not > exist, like blue2343.com, it takes upwards of 5 seconds to print
"Not Valid" > to the screen. Why is that? and is there a way around it? > > Thanks, > > Scott > >
Scot, set a breakpoint on your GetHostByName line (right-click on the line
and click set breakpoint). When you run the app it will stop there, and
then hit F11 to step into the code line by line and you will see where the
hic-cup is occurring.
Scot, set a breakpoint on your GetHostByName line (right-click on the line
and click set breakpoint). When you run the app it will stop there, and
then hit F11 to step into the code line by line and you will see where the
hic-cup is occurring.
I set the breakpoint on that line, then hit F11.
It highlights Sub Main() in yellow with a yellow arrow to the left.
F11 again, domainName line is now in yellow
F11, Try in yello
F11, breakpoint line in yellow
F11, End Try in yellow
F11, console.writeli ne in yellow
F11, sleep in yellow
then End Sub ends up in yellow
Nothing seems to take the 5 seconds, even when I rapidly go through it with
F11.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:ur******** ******@TK2MSFTN GP10.phx.gbl... Scot, set a breakpoint on your GetHostByName line (right-click on the line and click set breakpoint). When you run the app it will stop there, and then hit F11 to step into the code line by line and you will see where the hic-cup is occurring.
I set the breakpoint on that line, then hit F11.
It highlights Sub Main() in yellow with a yellow arrow to the left.
F11 again, domainName line is now in yellow
F11, Try in yello
F11, breakpoint line in yellow
F11, End Try in yellow
F11, console.writeli ne in yellow
F11, sleep in yellow
then End Sub ends up in yellow
Nothing seems to take the 5 seconds, even when I rapidly go through it with
F11.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message
news:ur******** ******@TK2MSFTN GP10.phx.gbl... Scot, set a breakpoint on your GetHostByName line (right-click on the line and click set breakpoint). When you run the app it will stop there, and then hit F11 to step into the code line by line and you will see where the hic-cup is occurring.
"Scot" <bl***@blank.bl ank.com> wrote in message
news:c5******** @library1.airne ws.net... I haven't tried that. Unfortunately I am not an "official" programmer,
Ha! don't worry about being an official programmer. I've met "official" or
"profession al" programmers that don't know a damn thing. =)
so I more or less hack things together until they work. I wouldn't have even
the first bit of a clue as far as how to step into the try....catch block. In fact this is the first time I have ever used one in vb.net, and it was
only because I couldn't solve the situation another way.
It takes this long everytime I run the app, but it is started from scratch each time. "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:eU******** ******@TK2MSFTN GP11.phx.gbl... Scot,
What happens when you step into the code? Does it takes this long everytime you run the app, even if the process is not recycled? Charles is saying "I have noticed that the first time an exception is thrown and caught, a
..NET application can take a significant time (several seconds) before
returning control to the catch block." Have you confirmed this is what is
happening by stepping into the try...catch block?
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... I think Charles is correct in his assumption. I understand that DNS lookups on non-existant domains take longer, but not in the 3 to 5 second
range. A second or two would be acceptable, but even that would be long if you there was minimal network latency.
I believe it is something in the Try..Catch segment. Anyone? "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:Oq******** *****@tk2msftng p13.phx.gbl... > Scot, > > This is mostly likely due to the time it is taking for your DNS
server to > attempt to resolve the DNS name to an IP address. It is not
uncommon for > 3-6 seconds to pass while DNS attempts to resolve an entry that does not > exist. There is no way around the time it takes for a DNS server to exhaust > its resources in an attempt to resolve hostnames to ip addresses. > > HTH, > > Raymond Lewallen > > "Scot" <bl***@blank.bl ank.com> wrote in message > news:c5******** @library1.airne ws.net... > > I have the following code: > > > > Dim IP, domainName As String > > domainName = "yahoo.com" > > > > Try > > IP = > System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring() > > Catch ex As Exception > > IP = "Not Valid" > > End Try > > > > Console.WriteLi ne(IP) > > System.Threadin g.Thread.Sleep( 2000) > > > > > > When it has a resolvable domain, like yahoo.com it responds back instantly > > with the ip address. However, if there is a domain in there that does not > > exist, like blue2343.com, it takes upwards of 5 seconds to print "Not > Valid" > > to the screen. Why is that? and is there a way around it? > > > > Thanks, > > > > Scott > > > > > >
"Scot" <bl***@blank.bl ank.com> wrote in message
news:c5******** @library1.airne ws.net... I haven't tried that. Unfortunately I am not an "official" programmer,
Ha! don't worry about being an official programmer. I've met "official" or
"profession al" programmers that don't know a damn thing. =)
so I more or less hack things together until they work. I wouldn't have even
the first bit of a clue as far as how to step into the try....catch block. In fact this is the first time I have ever used one in vb.net, and it was
only because I couldn't solve the situation another way.
It takes this long everytime I run the app, but it is started from scratch each time. "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:eU******** ******@TK2MSFTN GP11.phx.gbl... Scot,
What happens when you step into the code? Does it takes this long everytime you run the app, even if the process is not recycled? Charles is saying "I have noticed that the first time an exception is thrown and caught, a
..NET application can take a significant time (several seconds) before
returning control to the catch block." Have you confirmed this is what is
happening by stepping into the try...catch block?
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message news:c5******** @library1.airne ws.net... I think Charles is correct in his assumption. I understand that DNS lookups on non-existant domains take longer, but not in the 3 to 5 second
range. A second or two would be acceptable, but even that would be long if you there was minimal network latency.
I believe it is something in the Try..Catch segment. Anyone? "Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:Oq******** *****@tk2msftng p13.phx.gbl... > Scot, > > This is mostly likely due to the time it is taking for your DNS
server to > attempt to resolve the DNS name to an IP address. It is not
uncommon for > 3-6 seconds to pass while DNS attempts to resolve an entry that does not > exist. There is no way around the time it takes for a DNS server to exhaust > its resources in an attempt to resolve hostnames to ip addresses. > > HTH, > > Raymond Lewallen > > "Scot" <bl***@blank.bl ank.com> wrote in message > news:c5******** @library1.airne ws.net... > > I have the following code: > > > > Dim IP, domainName As String > > domainName = "yahoo.com" > > > > Try > > IP = > System.Net.Dns. GetHostByName(d omainName).Addr essList(0).ToSt ring() > > Catch ex As Exception > > IP = "Not Valid" > > End Try > > > > Console.WriteLi ne(IP) > > System.Threadin g.Thread.Sleep( 2000) > > > > > > When it has a resolvable domain, like yahoo.com it responds back instantly > > with the ip address. However, if there is a domain in there that does not > > exist, like blue2343.com, it takes upwards of 5 seconds to print "Not > Valid" > > to the screen. Why is that? and is there a way around it? > > > > Thanks, > > > > Scott > > > > > >
Scot,
Not the first time I've seen something like this. I've actually had code
that would throw exceptions when just running through it, but when I stepped
through it, would work just fine! It stinks to say it, but rebooting often
helped that problem (not that it actually occurred on a regular basis). I'm
afraid I have no more advice on the subject, and I hate to leave you with
"Maybe you'll have to live with it", so hopefully someone else will have a
good suggestion.
Sorry I couldn't be of more help,
Raymond Lewallen
"Scot" <bl***@blank.bl ank.com> wrote in message
news:c5******** @library1.airne ws.net... I set the breakpoint on that line, then hit F11.
It highlights Sub Main() in yellow with a yellow arrow to the left. F11 again, domainName line is now in yellow F11, Try in yello F11, breakpoint line in yellow F11, End Try in yellow F11, console.writeli ne in yellow F11, sleep in yellow then End Sub ends up in yellow
Nothing seems to take the 5 seconds, even when I rapidly go through it
with F11.
"Raymond Lewallen" <Ra************ ******@nospam.f aa.gov> wrote in message news:ur******** ******@TK2MSFTN GP10.phx.gbl... Scot, set a breakpoint on your GetHostByName line (right-click on the
line and click set breakpoint). When you run the app it will stop there, and then hit F11 to step into the code line by line and you will see where
the hic-cup is occurring.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dmiller23462 |
last post by:
Hey guys, I'm back again....I've got the results displaying that I
wanted but instead of having a "next" or "previous" link displayed I
am getting the error msg below (I actually get the data that I'm
supposed to get meaning that my query seems to be working fine but
instead of making its way to the INCLUDE file (bottom navigation bar)
it displays the following error msg instead of the included nav bar...
***
error '80020009'
Exception...
|
by: __frank__ |
last post by:
The following code use a macro and a label.
I would to change it and use instead
a more readable function and avoid the label.
The macro DAQmxFailed checks for the return code
of the various functions:
DAQmxCreateTask()
DAQmxStartTask()
DAQmxReadAnalogScalarF64()
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte buffer into the character
pointer. The code looks like the following:
#include <stdio.h>
#include <stdlib.h>
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
|
by: Scot |
last post by:
I have the following code:
Dim IP, domainName As String
domainName = "yahoo.com"
Try
IP = System.Net.Dns.GetHostByName(domainName).AddressList(0).ToString()
Catch ex As Exception
IP = "Not Valid"
End Try
|
by: Bart Van der Donck |
last post by:
Hello,
I'm posting the software for one-FAQ-a-day as described on
http://tinyurl.com/qcxw7
(comp.lang.javascript, July 18 2006, titled "CLJ newsgroup FAQ)
and on
http://tinyurl.com/ppt2s
(comp.lang.javascript, July 22 2006, titled "Automation of
comp.lang.javascript FAQ")
| |
by: Somebody |
last post by:
Hi,
I'm trying to write the function below and have it working, but I
benchmarked it against strcmp() and its much slower. My test is to compare 2
strings that are identitical 100,000,000 times. Yeah, thats a lot, but I
needed to scale up the test to get a real timing on the function. The weird
thing is, even when I comment out almost the entire function, its still much
slower then strcmp()... at full implementation, strcmp() takes 5...
|
by: Platonic Solid |
last post by:
Hi-
I am learning C from some old lecture notes, but they don't have
solutions so I'd like some feedback on my code if anyone has the time.
This is an exercise: "Write a program to trim any leading whitespace
from a string and return a newly allocated buffer containing the trimmed
string. Don't forget to handle errors."
main(argc, argv)
|
by: dragiton |
last post by:
ASP Code Redirect Error
Hello I recently relaunched a website containing asp code which used to work perfectly. However, after resetting up the SQL DB and trying to work out some site bugs I have the following problem: any suggestions?
I have a newuser login page that creates a new SQL DB table record with login name and password then takes the user to the next (page) step in the registration setup. Currently the record is created in the...
|
by: =?Utf-8?B?R3JlZw==?= |
last post by:
I have the following three files.
1. Users.aspx is a webpage that uses the <asp:ObjectDataSourcecontrol to
populate a simple <asp:ListBoxcontrol.
2. The UserDetails.cs file creates a Namespace named UserComponents and
creates an object named UserDetails.
3. The UserDB.cs file retrieves the actual data from the database.
The code below has been condensed and only includes two fields from my
datasource. I actually am also
retrieving...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |