1. Get IP Address with tcp.ew? Today?!

Please, for the love of all that's good and holy...

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! :)

Thanks.

new topic     » topic index » view message » categorize

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

cklester wrote:
> 
> 
> Please, for the love of all that's good and holy...
> 
> 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! :)
> 
> Thanks.
> 

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?

Jonas

new topic     » goto parent     » topic index » view message » categorize

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

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.

new topic     » goto parent     » topic index » view message » categorize

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

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 message » categorize

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

Jonas Temple wrote:
> 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, thanks for the help! I don't want to have to
do the event handler for WM_HOSTINFO. I don't get that. How
will it fit into my program? I think I'll just run "ipconfig"
and parse the output! :)

new topic     » goto parent     » topic index » view message » categorize

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

You could use TCP4U as below.. (works for me..)

sequence ip, Actual_Addr
ip = tcp4u_get_local_id()
      Actual_Addr = sprintf( "%s", {ip[tcp4u_host_id]} )

Pete.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu