Results 1 to 5 of 5

Thread: IP Ping using VB.NET

  1. #1
    Join Date
    Jul 2006
    Posts
    182

    IP Ping using VB.NET

    Hi Friends,
    I am new on this forum, so please ignore my mistakes. I am having many network attached storage on my network. And these network are attached to network over a spread location. I am having the spread sheet which contains all IP addresses. Now my question is that is it possible to open the spreadsheet or application i need to know whether the NAS is still live.? I don't know whether this would be easier in excel VBA or Visual Studios VB.NET.!? If possible provide me the help in VBA or Visual Studios VB.NET. If anyone has any knowledge of this would be great and maybe an example of 1 IP ping in either application so that i can replicate myself or something.
    "Yea though I walk through the valley of the shadow of death... I will fear no evil." -Psalms 23

    K8N Diamond Plus (BIOS v1.2)
    AMD Athlon 64 X2 4400+
    Antec TruControl 550W
    NVidia GeForce 7900GT (NGO v1.8466 BETA)
    OCZ Platinum 2x1GB (2-3-2-5)
    SATA: WD740
    PATA: 2xWD2500, WD1200, NEC DVD/RW

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: IP Ping using VB.NET

    There may be several approaches for getting the desired result of your query. The command to run this is :
    Code:
    ping IP | echo %errorlevel%
    After putting this command you will get the one output out of two. The output will be either 0 (live) or 1 (dead). You can do one of three things:
    1. You can run a macro that changes the sheet and reopens the sheet, by opening the spreadsheet.
    2. Also you can have an autorun function, after opening the spreadsheet that updates the sheet on open.
    3. And the last thing to do is running a batch file to generate and load the updated spreadsheet.

    According to me the last option is the better and the easiest.

  3. #3
    Join Date
    Apr 2008
    Posts
    2,005

    Re: IP Ping using VB.NET

    I would like to suggest you to download the application called AdvancedRM. By using the AdvancedRM you can do the Network Monitoring Utility for every SNMP enabled device in your network. This application is also useful to monitor any interface of any router, PC, switch, NAS etc that has SNMP activated. Also you will get this application free on the Web and its very small and lightweight program that does not waste your system resources. So you can try this application.

  4. #4
    Join Date
    Nov 2008
    Posts
    1,185

    Re: IP Ping using VB.NET

    It will be much better if you write the ping code yourself so you can control exactly how you do the ping. Also the advantage of writing the ping code is that there will be nothing stopping you from spawning off the PING.EXE program that comes with Windows itself to do the work. PING.EXE returns an error code of 1 if the host did not respond on the Windows XP operating system. And if the host responded, PING.EXE returns 0. You may not able to start programs from your application if there's security issues or you are running as a Win32 Service. So you'll have to handle that situation yourself. Hope that this will help you while writing the ping code.

  5. #5
    Join Date
    Apr 2008
    Posts
    1,948

    Re: IP Ping using VB.NET

    This code can help you to Ping your IP using the VB.Net. This code is written in VB.Net.
    Code:
    Public Function ComputerIsOnline(ByVal strComputerName As String) As Boolean
    On Error GoTo ErrorHandler
    
    Dim strRes  As String
    Dim ShellX      As String
    Dim FileNum     As Integer
    Dim lPid        As Long
    Dim lHnd        As Long
    Dim lRet        As Long
    
    'DoEvents
    ShellX = Shell("command.com /c ping -n 2 " & strComputerName & " > log.txt", vbHide)
    lPid = ShellX
    If lPid <> 0 Then
    lHnd = OpenProcess(SYNCHRONIZE, 0, lPid)
    If lHnd <> 0 Then
    lRet = WaitForSingleObject(lHnd, INFINITE)
    CloseHandle (lHnd)
    End If
    FileNum = FreeFile
    Open "log.txt" For Input As #FileNum
    strResult = Input(LOF(1), 1)
    Close #FileNum
    ComputerIsOnline = (InStr(strResult, "Lost = 0") > 0)
    End If
    Exit Function
     ErrorHandler:
    ComputerIsOnline = False
    Exit Function
    End Functio

Similar Threads

  1. Wireless cannot ping / ethernet can ping
    By Nereus in forum Networking & Security
    Replies: 6
    Last Post: 14-08-2010, 05:56 AM
  2. Replies: 3
    Last Post: 05-02-2009, 02:27 PM
  3. How to Ping?
    By Maximus() in forum Technology & Internet
    Replies: 5
    Last Post: 12-01-2009, 06:30 AM
  4. I can ping with IPv6. I can not ping with IPv4.
    By Eric Gamess in forum Vista Help
    Replies: 2
    Last Post: 04-05-2008, 01:31 AM
  5. Can resolve DNS, can ping IP, but can't ping by DNS??
    By Bryan L in forum Windows Server Help
    Replies: 14
    Last Post: 23-01-2007, 03:51 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,531,355.41040 seconds with 17 queries