FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour IP de red
Posts: 128
Joined: Wed Oct 26, 2005 12:18 PM
IP de red
Posted: Wed May 21, 2008 03:45 AM

Hola.
La funci贸n ShowIP() me da la IP de internet.
1) 驴 C贸mo puedo averiguar el proveedor de internet y la puerta de enlace?. Hasta ahora lo hago enviando el resultado de ejecutar ipconfig a un archivo y ley茅ndolo

2) 驴 Hay alguna otra funci贸n que me d茅 la IP de red?

Gracias.

Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
IP de red
Posted: Wed May 21, 2008 08:59 PM

Hola,
La funcion GetIp debe llamarse en el on init de la ventana principal

ACTIVATE WINDOW oWnd ON INIT GetIp(oWnd)

Function GetIp(oWnd)
local nIp,oSocket,cIp, nLen

oSocket := TSocket():New( 2000 ) // New(2000)
cIp := oSocket:cIPAddr
oSocket:End()

Salu2

Posts: 654
Joined: Mon May 29, 2006 03:14 PM
IP de red
Posted: Thu May 22, 2008 08:56 AM

驴 Y si tengo mas de una tarjeta de red ?

驴 Como puedo saber los datos de todas las interfaces ?

Gracias.

Mi abuelo dec铆a: Los aviones vuelan porque Dios quiere, y los helic贸pteros ni Dios sabe porque vuelan.

FWH 16.02, xHarbour 1.2.3, Harbour 3.2.0, WorkShop 4.5, AJ Make 0.30, Borlan BCC 7.00, VisualStudio 2013
Posts: 128
Joined: Wed Oct 26, 2005 12:18 PM
IP de red
Posted: Tue May 27, 2008 03:31 AM

Willi:

La function GetIP() me vuelve a dar la IP de internet, como ShowIP().

Lo que quiero obtener es la ip del pc, en mi caso 192.168.0.1

Yo veo esta direcci贸n en varios valores del registro, pero no s茅 cual de ellos de da siempre esta ip. Algunos son:

1)En las claves DefaultGateWay y en IPaddress de
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services{B0121E7B-3389-40D8-8E2A-4068E39B79C5}\Parameters\Tcpip\

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Services{B0121E7B-3389-40D8-8E2A-4068E39B79C5}\Parameters\Tcpip

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services{B0121E7B-3389-40D8-8E2A-4068E39B79C5}\Parameters\Tcpip

2) En las claves IPaddress y NameServer de
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters\Interfaces{B0121E7B-3389-40D8-8E2A-4068E39B79C5}\

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet003\Services\Tcpip\Parameters\Interfaces{B0121E7B-3389-40D8-8E2A-4068E39B79C5}

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces{B0121E7B-3389-40D8-8E2A-4068E39B79C5}

Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
IP de red
Posted: Tue May 27, 2008 02:05 PM

Veamos
Yo utilizo esta funcion para saber cual es el ip de pc en la que esta ejecunatdo mi aplicacion

oSocket := TSocket():New( 2000 ) // New(2000)
cIp := oSocket:cIPAddr
oSocket:End()

ip es igual al ip que le asigne al configurar la tarjeta de red.

Salu2

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
IP de red
Posted: Tue May 27, 2008 02:10 PM

Can U post here an sample How found pc are link with your pc and save the ip address into listbox?

Sample : I work on a pc ( server) in a classroom and I see 20 pc
the 20 pc are on line and all link to Domain called LAB2

Can I see automatically all pc ?

Best Regards, Saludos



Falconi Silvio
Posts: 1054
Joined: Sun Oct 09, 2005 10:41 PM
IP de red
Posted: Tue May 27, 2008 02:49 PM

Hola Silvio
puedes probar con los siguiente comando en modo consola

C:\netstat > lista.txt

C:\arp -a > lista.txt

y luego lo levantas a lis listbox y zas... espero te sirva

Salu2

Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
IP de red
Posted: Tue May 27, 2008 03:26 PM

I know it but I try to create something into fwh
I saw delphi and vb can make it...easy

Best Regards, Saludos



Falconi Silvio

Continue the discussion