1. Get IP Address with tcp.ew? Today?!
- Posted by cklester <cklester at yahoo.com> Apr 23, 2004
- 531 views
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.
2. Re: Get IP Address with tcp.ew? Today?!
- Posted by Jonas Temple <jtemple at yhti.net> Apr 23, 2004
- 498 views
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
3. Re: Get IP Address with tcp.ew? Today?!
- Posted by cklester <cklester at yahoo.com> Apr 23, 2004
- 483 views
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.
4. Re: Get IP Address with tcp.ew? Today?!
- Posted by Jonas Temple <jtemple at yhti.net> Apr 23, 2004
- 493 views
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
5. Re: Get IP Address with tcp.ew? Today?!
- Posted by cklester <cklester at yahoo.com> Apr 23, 2004
- 513 views
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! :)
6. Re: Get IP Address with tcp.ew? Today?!
- Posted by Pete <pete_stoner at btconnect.com> Apr 24, 2004
- 493 views
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.