Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieving TCP/IP Address
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00140525
Message ID:
00166103
Vues:
25
>If you could add it, that'd be great. BTW, how are things?
>
>-Jay
>
>>>>>Anyone know an easy way to retrieve the local TCP/IP address using VFP?
>>>>
>>>>IP Address? I believe NetBios does this. But for the free way, Rick Strahl's wwIPStuff class has a method called GetIPFromDomain that does a DNS Lookup on a domain name...
>>>
>>>Thanks, Eric. But I'm wanting the acutal IP address for the machine that my Exe's runninging on, which coincidentally won't have a DNS entry.
>>
>>The API is in WinSock called GetHostName. I have the code for it, but
>>wwIPStuff doesn't expose this. If you really need it, I can add it
>>in a few minutes...
>>
>>+++ Rick ---

Here's the code for ipaddress.
* getipaddress.prg  
* John Harvey
* 9/28/98
* Leave IPSocket public to view all properties in the debug window.
* I stumbled on this routine while trying to find information on  subclassing
* the WSH and thought it might be useful.
* public IPSocket  && uncomment if you want to test.
crlf=chr(13)+chr(10)
* Show local ip address
IPSocket = CreateObject("MSWinsock.Winsock")
if type('IPSocket')='O'
IPAddress = IPSocket.LocalIP
localhostname=IPSocket.localhostname
remotehost=IPSocket.remotehost
remotehostip=IPSocket.remotehostip
MessageBox ("Local IP = " + IPAddress+crlf+"local host = "+localhostname;
+crlf+"Remotehost = "+remotehost+crlf+"Remotehostip = "+remotehostip)
else
MessageBox ("Winsock Is Not Installed!")
endif
John Harvey
Shelbynet.com

"I'm addicted to placebos. I could quit, but it wouldn't matter." Stephen Wright
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform