[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

network check

Posted on 2004-03-29
6
Medium Priority
?
175 Views
Last Modified: 2013-11-13
HI experts...
  I am trying to creating an application in visual basic such that if the communication link (LAN Cable) between 2 pc's is not available(broken/removed) then it must trigger a message. I think I might have to use windows API for that but I am not too sure. Can you all please help me? I am really looking forward to your comments.
0
Comment
Question by:Daran_M
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 19

Expert Comment

by:Melih SARICA
ID: 10709572
U can ping the Computer .. and when u dont get an reply trigger an event...

here is a simple ping code for VB ( Thanx to PLG)

Public Function Ping(sAddress As String, _
                     sDataToSend As String, _
                     ECHO As ICMP_ECHO_REPLY) As Long

   Dim hPort As Long
   Dim dwAddress As Long
   
  'convert the address into a long representation
   dwAddress = inet_addr(sAddress)
   
  'if dwAddress is valid
   If dwAddress <> INADDR_NONE Then
   
     'open a port
      hPort = IcmpCreateFile()
     
     'and if successful,
      If hPort Then
     
        'ping it.
         Call IcmpSendEcho(hPort, _
                           dwAddress, _
                           sDataToSend, _
                           Len(sDataToSend), _
                           0, _
                           ECHO, _
                           Len(ECHO), _
                           glngPingTime)

        'return the status as ping success
         Ping = ECHO.status

        'close the port handle
         Call IcmpCloseHandle(hPort)
     
      End If  'If hPort
     
   Else:
   
        'the address format was probably invalid
         Ping = INADDR_NONE
         
   End If
 
End Function
0
 
LVL 1

Expert Comment

by:developer007
ID: 10709833
Yeh..

 Some times the connection is proper and ping may not happen also..


   
0
 

Author Comment

by:Daran_M
ID: 10714446
HI experts,
         thanks for the reply. Isn’t there any API function that can be used to achieve this? thanks once again for the reply.
0
 
LVL 19

Accepted Solution

by:
Melih SARICA earned 200 total points
ID: 10714528
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Simple Linear Regression

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question