Hi,
I'm looking for the most elegant way to check if a connection is available to an ftp site.
For example, I would lie to check the status of the connection before running a routine.
Regards
HerbiNZ
Hi,
I'm looking for the most elegant way to check if a connection is available to an ftp site.
For example, I would lie to check the status of the connection before running a routine.
Regards
HerbiNZ
Most elegant way to check if a network connection is available
.asim
If you asking to check that the you have a network connection prior to trying to do a file upload to an FTP
Using VB.Net 2005 you can use the My Classes.
The general construct would be something like the following. You simply need to put you filename and URL Address in there which would be you FTP location.
If My.Computer.Network.IsAvailable Then
Try
my.Computer.Network.UploadFile(<FileName>,<Address>)
Catch ex As Exception
End Try
End If
Ramesh_R
if you want to check if you can connect to the FTP site, you can use
if my.computer.network.ping("your.ftp.server") instead of my.computer.network.isavailable above
Cheers
Mark
Sanjay Modi
I would probably do a combination of both. That is that I wouldnt bother doing a ping if there wasnt any network connectivity as it would probably fail.
So you check to see that you have a network connection, if you do you ping the ftp server and if you get a positive response then you upload the file to the ftp server.
If My.Computer.Network.IsAvailable Then
if my.computer.network.ping("your.ftp.server") then
my.Computer.Network.UploadFile(<FileName>,<Address>)
end if
End If
dipika
I want to Continues Ping a Host My system has 2 Network card
When i use the
If My.Computer.Network.IsAvailable Then
if my.computer.network.ping("your.ftp.server") then
me.oicstatus.image=pic_yes.image
else
me.oicstatus.image=pic_yes.image
end if
End If
on a timers tick event
My Application Hanges up and also it gives the Stats different from Windows Ping Command
Please help me