Re: Get IP Address with tcp.ew? Today?!

new topic     » goto parent     » topic index » view thread      » older message » newer message

cklester wrote:
> 
> 
> Jonas Temple wrote:
> > cklester wrote:
> > > can somebody provide a routine whereby I can get the
> > > PC's IP address? I don't understand Robert Szalay's
> > > example MyIPAddr.exw, although it does what I need! :)
> > Have you tried using the tcp_gethostbyname function?  It seems that you
> > might want to call as:
> > 
> > sequence wrk_seq
> > wrk_seq = tcp_gethostbyname(mywindow, "localhost")
> > 
> > Or am I missing something?
> 
> Doing that, wrk_seq is set to 1.
> 

Yep, that's right.

You'll either get a number > 0 or a -1 (-1 being an error).  In your
Win app you'll need to have an event handler to catch the WM_HOSTINFO
message.  Once you get that message you'll call tcp_host_info()
passing the returned valued from tcp_gethostbyname.  You'll get back
(if everything works) a sequence of two elements, the first being the 
ip address and the second being the host name.

You can cancel the host name lookup by calling tcp_cancel_lookup passing
the value returned from tcp_gethostbyname.  Take a look at the example.txt
that comes with the tcp.ew .zip.

Jonas

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu