How to check if the connection to a remote computer exist

C

Chin Chien Ping

Hi,

I looking for a solution for how to check if a connection to a remote
computer exist or not using vb.net.

I 'm writing a program which will request data from a remote sql server. I
need to check if the connection to the remote server exist, before open the
connection or run the the sql command.

Pls helps, urgent.

Thanks,
Chin
 
H

Hayato Iriumi

Hello Chin,

I'd try to open the connection. If exception occurs, that means the connection
to the SQL Server can't be established.
 
C

Chin Chien Ping

I have tried this method.

However, this will coz my system hang, and I only knew the connection does
not exist until the connection timeout.

Is there any better solution ?

Thanks,
Chin
 
H

Hayato Iriumi

I really don't think there is any other solution. When you say "system
hang", does that mean your UI hangs? If that's the case, I'd spawn off a
thread to let it do check connection checking and let it raise an event
to see if the connection succeeded or not. That way, your UI won't hang.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top