Page 1 of 1

Give IP Address in one variable

Posted: Sat Mar 06, 2004 12:27 am
by omid-xp
How can i give Ip address in one variable?

i really need to this.

thanks.

Posted: Sat Mar 06, 2004 1:25 pm
by merendo
MakeIPAddress(field1,field2,field3,field4)

Please read the manual.

Posted: Sat Mar 06, 2004 1:54 pm
by omid-xp
Thanks merendo but i want give current machine IP adress and then set it in a varible.

i no want make one fake ip address.

i must use one API for it ? or winsock ? or....

i need to this source.

thanks.

Posted: Sat Mar 06, 2004 3:00 pm
by sec

Code: Select all

InitNetwork()
b1.s=Hostname()
r1.l=gethostbyname_(@b1)
r2.l=PeekL(PeekL(PeekL(r1+12)))
Debug r2 ; what do you need?
Debug IPString(r2) ;ipv4 with dot

Posted: Sat Mar 06, 2004 11:32 pm
by omid-xp
thanks sec for source code.

Posted: Tue Mar 23, 2004 9:22 pm
by Joey
Is this what u meant? Cause my code puts local IP address straight to a variable if thats what u meant

Code: Select all

InitNetwork()
InitNetwork()
  ExamineIPAddresses()
  AA$ = IPString(NextIPAddress())
  MessageRequester("Local IP", "Local IP Address is : "+AA$+" ",#PB_MessageRequester_Ok)
                  
I put a message requester in there just to prove it works :P

If you want the IP address in Long form etc just take out the IPString() and make the variable a long, you prob knew that so sry.