Click here to Skip to main content
15,895,142 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionapplication bar Pin
Ali el12-Mar-07 21:30
Ali el12-Mar-07 21:30 
Questionincorporating media player in vb.nety application Pin
onrivman12-Mar-07 21:21
onrivman12-Mar-07 21:21 
QuestionHelp regarding Serial Port in .NET 2005 Pin
yrsoft12-Mar-07 20:43
yrsoft12-Mar-07 20:43 
AnswerRe: Help regarding Serial Port in .NET 2005 Pin
TwoFaced12-Mar-07 21:20
TwoFaced12-Mar-07 21:20 
QuestionDatagrid Using Combobox and textbox and Automatically ComboBox and Datagrid Column also has to come pls Tell me... Pin
somagunasekaran12-Mar-07 19:20
somagunasekaran12-Mar-07 19:20 
QuestionSqlHelper Class Pin
cst_cfit12-Mar-07 18:23
cst_cfit12-Mar-07 18:23 
QuestionData Grid Selection Pin
umesh896512-Mar-07 17:59
umesh896512-Mar-07 17:59 
QuestionApplication Slowdown Question Pin
tgebrael12-Mar-07 17:57
tgebrael12-Mar-07 17:57 
Hi Guys

I was wondering if someone could help me figure out what I need to do to get this function to perform properly

Let me explain what I am doing.

I have an updating app to update a different app.

Since it is critical for internet connection to be valid I made a function to do the check. And not like microsoft and other boards suggest because that really only tells you you have a connection but not that you can actually communicate. For example I could change my IP address on my nic and not be able to browse yet it still says I'm connected.


So my function startecd off as a simple My.computer.network.ping

That was working great until I realized when I was at my friends house that some isp's block the ICMP request even though the connection is valid.

So I said ok I am going to change the ping to a lookup routine for a domain and if its address length=3 which means it found it then internet is available.

Now that works great in both situations where icmp is available or not except the delay in the check is slower than a straight ping request.

So what I was trying to do next was to first try the ping and if it didnt work try the nslookup and then return a value. It seems to be working but it seems to hang my machine.

I think I'm looped wrong or something. For example I have an animated gif on my main form that when it runs the function in dual mode moves at a snails pace. When I use either ping or nslookup alone it functions fine.

Do I need a background worker or something.

I'm sorry I am very new to programming and don't really even understand how to use background workers or if thats what I even need.

Maybe I just need to reorder my function.

In either case I will post my function code. If this info isn't sufficient I will add anything you need.

Thank you in advance
Tony

Private Function isConnected() As String
Try
If Not My.Computer.Network.Ping("www.google.com") Then GoTo TryNext
TryNext:
Dim AddressLength As IPHostEntry
AddressLength = System.Net.Dns.GetHostEntry("google.com")
If AddressLength.AddressList.Length.Equals(3) Then
'The above three lines works better then this in case icmp is unavailable
'If My.Computer.Network.Ping("www.google.com") Then
m_isNetConnected = "Available"
Return m_isNetConnected
Else
m_isNetConnected = "Unavailable"
Return m_isNetConnected
End If
Catch Except As System.Net.Sockets.SocketException
m_isNetConnected = "Unavailable"
Return m_isNetConnected
Catch Except As InvalidOperationException
m_isNetConnected = "Unavailable"
Return m_isNetConnected
End Try
End Function
AnswerRe: Application Slowdown Question Pin
tgebrael12-Mar-07 18:01
tgebrael12-Mar-07 18:01 
AnswerRe: Application Slowdown Question Pin
TwoFaced12-Mar-07 18:52
TwoFaced12-Mar-07 18:52 
GeneralRe: Application Slowdown Question Pin
tgebrael12-Mar-07 21:47
tgebrael12-Mar-07 21:47 
QuestionNumber of sundays in a month.......... Pin
Member 387988112-Mar-07 17:50
Member 387988112-Mar-07 17:50 
AnswerRe: Number of sundays in a month.......... [modified] Pin
TwoFaced12-Mar-07 20:38
TwoFaced12-Mar-07 20:38 
GeneralRe: Number of sundays in a month.......... [modified] Pin
Member 387988112-Mar-07 23:29
Member 387988112-Mar-07 23:29 
GeneralRe: Number of sundays in a month.......... Pin
Member 387988112-Mar-07 23:54
Member 387988112-Mar-07 23:54 
Questiontrying to develop a program to run an .bat file as admin Pin
cpltek12-Mar-07 12:01
cpltek12-Mar-07 12:01 
AnswerRe: trying to develop a program to run an .bat file as admin Pin
Dave Kreskowiak12-Mar-07 12:45
mveDave Kreskowiak12-Mar-07 12:45 
GeneralRe: trying to develop a program to run an .bat file as admin Pin
cpltek13-Mar-07 3:05
cpltek13-Mar-07 3:05 
GeneralRe: trying to develop a program to run an .bat file as admin Pin
Dave Kreskowiak13-Mar-07 3:15
mveDave Kreskowiak13-Mar-07 3:15 
GeneralRe: trying to develop a program to run an .bat file as admin [modified] Pin
cpltek13-Mar-07 3:31
cpltek13-Mar-07 3:31 
GeneralRe: trying to develop a program to run an .bat file as admin Pin
cpltek13-Mar-07 3:38
cpltek13-Mar-07 3:38 
QuestionGet enter button command Pin
harveyhanson12-Mar-07 11:30
harveyhanson12-Mar-07 11:30 
AnswerRe: Get enter button command Pin
JUNEYT12-Mar-07 12:36
JUNEYT12-Mar-07 12:36 
GeneralRe: Get enter button command Pin
harveyhanson12-Mar-07 13:12
harveyhanson12-Mar-07 13:12 
GeneralRe: Get enter button command Pin
M-Hall12-Mar-07 14:44
M-Hall12-Mar-07 14:44 

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.