Testing a valid IP address? ( SOLVED! )

User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Testing a valid IP address? ( SOLVED! )

Post by JC »

Exists a way to testing if some IP address is valid?

I have tried this, but not works:

Code: Select all

FUNCTION isConnected( cNetEnd )

LOCAL lConected := .F.

inetInit()

aHosts := inetGetHosts( cNetEnd )

lConected := ( len( aHosts ) > 0 )

inetCleanUp()

RETURN( lConected )
Last edited by JC on Mon Oct 27, 2008 2:45 pm, edited 1 time in total.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Get valid IP

Post by ukoenig »

Hello JC,

Here is a tool, to get the IP Informations.
rename getip._xe to getip.exe

Get IP shows the Hostname and the IP-Adresses.
You can copy the informations to the clipboard and show it
in the Systray if you want.
It needs VB-Runtime 5

http://www.pflegeplus.com/fw_downloads/getip._xe

Regards
Uwe :lol:
Last edited by ukoenig on Mon Oct 27, 2008 1:50 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Uwe,

Thank you for this tip!

But, exists a way to do it with my application? Internally, via source?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

IP

Post by ukoenig »

Hello JC,

I don't know for the moment, but you
can call it with using WINEXEC inside your application.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Uwe,

Your executable returns to me the machine name and the ip address. Very cool!

Would get that return on getip.exe without open it?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

IP-Info

Post by ukoenig »

Hello JC,

some Infos from the help-file :
You can read from clipboard inside your application !!!

What Is Get IP?

Get IP is a small program which easily shows your hostname and all your local IP addresses. This information can then be copied to the clipboard for future use in any other application.

Many people can make sure of Get IP, especially gamers. How many times have you needed to give someone your IP address so you can play a game online? Probably a number of times. Now, with Get IP you can view your hostname and all your local IP addresses by simply loading Get IP. What's more, you can make Get IP automatically copy this information to clipboard, and then either minimise itself to your System tray or Task Bar for quick and easy access, or close the program entirely, so in a flash you have the information you want about your Internet connection.

Options

The Get IP options screen allows you to configure Get IP in every detail, including what the program does when it loads, and what it does when it has loaded.
Click on the section of the options menu you are interested in below for a detailed description on what the section does as how it changes the program.
Note that you can reset the options to their default values by clicking the 'Reset to defaults' button. You will be asked to confirm this action before the settings are reset.

Load Get IP When Windows Starts

When this option is ticked Get IP will load when Windows starts. This can be useful if you want your IP address copied to clipboard every time Windows starts.
If you want Get IP to load when Windows starts and then minimise to the System Tray, you need to select that option in the 'Options - Loading' section.

Allow Get IP To Run In The Background
When this option is ticked it will allow Get IP to run in the System Tray should you close the program. If you select 'Exit' from the 'Information' menu Get IP will always exit, whether this option is ticked or not. This option only applied when the 'X' is clicked in the top right hand corner of the main window.

Image

Image

Image

Image

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Uwe,

Now, works fine :)

But, We still have one problem: Will be necessary installing this application to execute my source function... always! :(
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Start application

Post by ukoenig »

Hello JC,

maybe just using a BATCH-File ( i didn't test it ) ?
A other way : a small exe with just 2 Winexec-calls.

START.bat
GetIP.exe
Myprog.exe

Regards
Uwe :lol:
Last edited by ukoenig on Mon Oct 27, 2008 2:41 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
Armando
Posts: 2479
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México
Contact:

Post by Armando »

JC:

Perhaps this can help you

Code: Select all

	WSAStartup()
	MsgInfo(GetHostByName("www.google.com.mx"))
	WSACleanUp()
Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Uwe and Armando,

Thanks!

I made, for local subnet, with this method:

? empty( getHostByAddress( "127.0.0.1" ) )
? empty( getHostByAddress( "17.0.5.102" ) )
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

GETIP

Post by ukoenig »

Armando,

Like JC explained :
I understand : he needs the IP-informations, before he starts
his application ?.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Uwe,

Actually, I want to see if an IP location of my local network is available ... if the machine is turned on, for example.

The function getHostByAddress( cNetIP ) is the best way to do it?
If returns empty... is because the IP is not valid!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Look for valid IP

Post by ukoenig »

Hello JC,

I will check, if there is something in Win-API to use.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Rochinha
Posts: 309
Joined: Sun Jan 08, 2006 10:09 pm
Location: Brasil - Sao Paulo
Contact:

Post by Rochinha »

JC,

GETHOSTBYNAME( YourIPString ) work´s?
User avatar
JC
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil
Contact:

Post by JC »

Rochinha wrote:JC,

GETHOSTBYNAME( YourIPString ) work´s?
Rochinha,

Funcionou com a função getHostByAddress( cNetAddress )... ela resolve o IP retornando o nome do endereço. Se for um IP local, ele retorna o nome da máquina (netbios name).

Quando o IP está inválido ou não existe um "site" ou máquina com o o IP informado... ela retorna branco.

Aí bastou testar se o retorno está em branco ou não!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Post Reply