Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I get the IP address from the local machine ?

764 views
Skip to first unread message

juliocesarramirez

unread,
Nov 4, 2004, 10:54:26 AM11/4/04
to
How can I get the IP adress of the local machine from a
PowerBuilder program?

Thanks

kishore

unread,
Nov 4, 2004, 10:58:40 AM11/4/04
to
You have to run the below script...............

GOOD LUCK........KISHORE

[Structure]
str_wsadata
unsignedinteger version
unsignedinteger highversion
character description[257]
character systemstatus[129]
nsignedinteger maxsockets
unsignedinteger maxupddg
string vendorinfo

[External function]

function int WSAStartup (uint UIVerionrequested, ref str_wsadata lpWSAdata)
library "wsock32.DLL"
function int WSACleanup() library "wsock32.DLL"
function int WSAGetLastError() library "wsock32.DLL"
function int gethostname(ref string name, int namelen) library
"wsock32.DLL"
function string GetHost(string lpszhost,ref blob lpszaddress) library
"pbws32.dll"

[Powerscript]

String ls_ip, ls_host
Blob{4} lb_host
Integer li_version, li_rc
str_wsadata lstr_wsadata

ls_host = Space(128)
li_version = 257

If WSAStartup(li_version, lstr_wsadata) = 0 Then
If GetHostName(ls_host, Len(ls_host)) < 0 Then
li_rc = WSAGetLastError()
Else
GetHost(ls_host, lb_host)
ls_ip = String(Asc(String(BlobMid(lb_host, 1, 1)))) + "."
ls_ip += String(Asc(String(BlobMid(lb_host, 2, 1)))) + "."
ls_ip += String(Asc(String(BlobMid(lb_host, 3, 1)))) + "."
ls_ip += String(Asc(String(BlobMid(lb_host, 4, 1))))
li_rc = 0
End If
MessageBox("My IP", ls_ip)
Else
li_rc = WSAGetLastError()
End If

WSACleanup()

sree

unread,
Nov 5, 2004, 5:13:58 AM11/5/04
to
Check out this link below

http://eric.aling.tripod.com/PB/tips/pbtip14.htm


Regards
Sree

juliocesarramirez

unread,
Nov 5, 2004, 3:29:10 PM11/5/04
to
Hello Kishore,
the scripts runs on PowerBuilder 9, but it doesn't work on
PowerBuilder 10. Have you ever tried this script on
PowerBuilder 10 ?

Thanks

juliocesarramirez

unread,
Nov 5, 2004, 3:30:49 PM11/5/04
to
Hello Sree,
the script/example runs on PowerBuilder 9, but it doesn't

work on PowerBuilder 10. Have you ever tried this
script/example on PowerBuilder 10 ?

Thanks

> Check out this link below

0 new messages