Visual Basic Core Snippet Routines
inet_addr
          
                 
   Converts a string containing an (Ipv4) Internet Protocol dotted address in the format "192.168.1.100'' into a proper numeric address (signed long value). The original address can be retrieved from the long using inet_ntoa.           
           Updated:   Monday December 26, 2011   
click to copy code:  



   Applies to:   VB4-32, VB5, VB6   
OS restrictions:   None  
 Code Snippet
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Declare Function inet_addr Lib "wsock32.dll" _
  (ByVal s As String) As Long
         
Private Function ConvertIPtoLong(sIpAddress) As Long

   ConvertIPtoLong = inet_addr(sIpAddress)

End Function

 Calling Syntax
  dwIpAddr = ConvertIPtoLong(sIpAddress)

 Comments / Related
demo in use:   IcmpSendEcho: Ping a Machine by IP Address
SendARP: Determine Local or Remote Adapter MAC Addresses
  
Related:   inet_ntoa   

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter