Drew Wutka
DWUTKA at Marlow.com
Tue Jun 30 11:49:15 CDT 2009
Actually, if you have an IP address, it is real. It then gets into what it is used for. For example, with your wireless, if it's not connected, it won't have an IP address. If a standard NIC is not connected, it will show no address. If it IS connected, but not receiving an IP address, it will default to a (I think) 169 something, which is a hard coded address, which means nothing. You can also have internal addresses such as 127.0.0.1, which is a loopback to your local machine. (so if you are running a website, putting in http://127.0.0.1 on the server will give you the local website). Drew -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby Sent: Tuesday, June 30, 2009 11:44 AM To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] Syslogs Yes, but then you have to do more. IPConfig shows several IP addresses on my work laptop. One is the wireless, which only works when in range of a wireless network, one is a physical NIC, and one is a Hamachi IP. There could be even more. On my server I have two physical NICS and in theory each could have asked for an IP address. So would the REAL IP address please stand up. John W. Colby www.ColbyConsulting.com Drew Wutka wrote: > There are several ways to get your IP address. Two I've used is to use > a Winsock control, and look at the local host IP. > > Another relatively easy way is to dump the results of IPCONFIG to a text > file. > > Create a .bat file (call it iptest.bat) and put the following line in > it: > > Ipconfig >C:\ip.txt > > Then using ShellWait (http://mvps.org/access/api/api0004.htm) > > Use this function: > > Function IPAddresses() As String > Dim f As Long > Dim strTemp As String > Dim strArray() As String > If Dir("C:\ip.txt") <> "" Then Kill "C:\ip.txt" > ShellWait "C:\iptest.bat" > f = FreeFile > Open "C:\ip.txt" For Binary Access Read As f > strTemp = Space(LOF(f)) > Get f, , strTemp > Close f > strArray = Split(strTemp, vbCrLf) > strTemp = "" > For f = 0 To UBound(strArray) > If InStr(1, strArray(f), "IPv4", vbTextCompare) > 0 Or InStr(1, > strArray(f), " IP Address", vbTextCompare) > 0 Then > strTemp = strTemp & Trim(Mid(strArray(f), InStr(1, strArray(f), > ":", vbBinaryCompare) + 1)) & ";" > End If > Next f > If Len(strTemp) > 0 Then strTemp = Left(strTemp, Len(strTemp) - 1) > IPAddresses = strTemp > End Function > > Whalla, IPAddresses will return as a semicolon delimited string. > (Obviously you could return an array or create a collection too...either > way....) > > Drew _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.