1. RE: System Ping (to resolve DNS)

So Kat, I'm curious...

How do <i>you</i> resolve names to numeric IP's?

Mark.



Kat wrote:
> On 30 Jul 2002, at 18:35, Mark Moran wrote:
> 
> > 
> > Hi folks
> > 
> > As part of an Internet client/server set of apps that I'm working on, 
> > I'm including a function to resolve the domain name to the associated 
> > IP.  (btw, I'm using win32lib and eulibnet includes at the moment.)
> > 
> > The way I've done it (certainly not the easiest, but it's the only way I 
> > 
> > could easily figure to do it) is to call the system's PING command 
> > (i.e., system("ping domain.com > pingresult.txt", i) - and can't 
> > remember whether I'm using 1, 2, or 3 as "i", but doesn't matter).  
> > 
> > Then I open this pingresult.txt file for reading within my program, and 
> > get the IP from the second line, which is between the "[" and "]".  Kind 
> > 
> > of kludgy (sp?), but it works.
> > 
> > What I don't like, other than the obvious kludginess of the coding to do 
> > 
> > all this, is that it opens a console window when it calls the system 
> > command -- not very elegant when the rest of the program is a 
> > nice-looking (IMHO) window.
> > 
> > >From the documentation, I 'think' system_exec() doesn't open a console, 
> > but it also says that re-direction cannot be used.  I'd have to test it 
> > of course, but...
> > 
> > Surely there's a more elegant way to do Internet resolution of domain 
> > names.  Do any of you know something that'll work entirely within the 
> > windows program (i.e., no additional console), and might be something as 
> > 
> > simple as:
> > 
> > include dns.e
> > sequence IPaddress
> > dns_resolve(domain.com)
> > IPaddress = whatIsReturnedFromdns_resolve
> > 
> > As mentioned, I'm using eulibnet, but I don't see anything in there that 
> > 
> > might do it (although I haven't fully inspected eulibnet.ew) -- perhaps 
> > there's something in tcp4u.ew?
> 
> No, but i have that on my to-do list also. Here is some possibly useful 
> info:
> 
> look for "gethostbyaddr" in:
> winsock.ew or ExWinsock.ew
> ftp://ftp.stardust.com/pub/winsock/version1/docs/spec/winsock.html 
> http://www.ibiblio.org/winsock/winsock-1.1/winsock.html
> 
> The call is in the tcp4w32.dll, so it is prolly accessable somewhere.
> 
> 
> ICMP 37= Domain Name Request
> ICMP 38= Domain Name Reply
> 
> CNAME
> 	The {canonical name} query type for {Domain Name System}.
> 	This query asks a DNS {server} for a {host}'s official
> 	{hostname}.
> ( it's case-insensitive )
> 
> see also:
> RFC 1034
> RFC 1035
> 
> I use the nameserver at 216.136.133.88.
> 
> Kat
> 
>

new topic     » topic index » view message » categorize

2. RE: System Ping (to resolve DNS)

Hi Mark,

Just to fill you in on euLibnet and euTCP4u ...

neither have what your looking for :(

euLibnet has "net_getpeer()" which returns the address of an open 
connection, and
Tcp4u has "TcpGetRemoteID()" does the same thing (but I could never get 
it to work :(.
Both of these assume you have already connected.

There was a contribution by Alexander Karpeev called 
"Ping and Trace-Route" which used euTcp4u for Pings and Traces ...
it looks great ... but the include was shrouded :(
I'd personally love to see the source ... but never contacted 
Alexander.

Ray Smith


Mark Moran wrote:
> Hi folks
> 
> As part of an Internet client/server set of apps that I'm working on, 
> I'm including a function to resolve the domain name to the associated 
> IP.  (btw, I'm using win32lib and eulibnet includes at the moment.)
> 
> The way I've done it (certainly not the easiest, but it's the only way I 
> 
> could easily figure to do it) is to call the system's PING command 
> (i.e., system("ping domain.com > pingresult.txt", i) - and can't 
> remember whether I'm using 1, 2, or 3 as "i", but doesn't matter).  
> 
> Then I open this pingresult.txt file for reading within my program, and 
> get the IP from the second line, which is between the "[" and "]".  Kind 
> 
> of kludgy (sp?), but it works.
> 
> What I don't like, other than the obvious kludginess of the coding to do 
> 
> all this, is that it opens a console window when it calls the system 
> command -- not very elegant when the rest of the program is a 
> nice-looking (IMHO) window.
> 
> >From the documentation, I 'think' system_exec() doesn't open a console, 
> but it also says that re-direction cannot be used.  I'd have to test it 
> of course, but...
> 
> Surely there's a more elegant way to do Internet resolution of domain 
> names.  Do any of you know something that'll work entirely within the 
> windows program (i.e., no additional console), and might be something as 
> 
> simple as:
> 
> include dns.e
> sequence IPaddress
> dns_resolve(domain.com)
> IPaddress = whatIsReturnedFromdns_resolve
> 
> As mentioned, I'm using eulibnet, but I don't see anything in there that 
> 
> might do it (although I haven't fully inspected eulibnet.ew) -- perhaps 
> there's something in tcp4u.ew?
> 
> Thanks in advance folks.
> 
> Mark.
> 
> 



Ray Smith
http://rays-web.com

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

3. RE: System Ping (to resolve DNS)

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C23827.5197FB70

Aw ya... that's exactly what I needed :)  Thanks again Jason!

Hey Kat... check this out... it certainly does what we're needing.  (What
I'm needing anyway)

Mark.

-----Original Message-----
From: Jason Mirwald [mailto:mirwalds at prodigy.net]
Sent: Tuesday, July 30, 2002 4:43 PM
To: EUforum
Subject: Re: System Ping (to resolve DNS)



Actually, if you go to http://pages.prodigy.net/mirwalds/ you will find
tcp.ew on the page. It includes heaps.e and structs.e (both by Chris
Bensler) to handle the memory operations, but it wraps the Async versions of
both gethostbyname() and gethostbyaddr().

 It does handle alot of the painfull stuff for Async lookups, and I believe
that the libs are all compatable with win32lib.

The zip file itself is here: http://pages.prodigy.net/mirwalds/tcp.zip

Jason





******************************************************************************
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else
is unauthorized.
 
If you are not the intended recipient, any disclosure, copying, distribution
or any action taken or omitted to be taken in reliance on it, is prohibited
and may be unlawful. When addressed to our clients any opinions or advice
contained in this email are subject to the terms and conditions expressed in
the governing KPMG client engagement contract.
******************************************************************************


------_=_NextPart_001_01C23827.5197FB70
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Diso-8859-=
1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2654.89">
<TITLE>RE: System Ping (to resolve DNS)</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Aw ya... that's exactly what I needed :)&nbsp; Thanks aga=
in Jason!</FONT>
</P>

<P><FONT SIZE=3D2>Hey Kat... check this out... it certainly does what we're=
 needing.&nbsp; (What I'm needing anyway)</FONT>
</P>

<P><FONT SIZE=3D2>Mark.</FONT>
</P>

<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Jason Mirwald [<A HREF=3D"mailto:mirwalds at prodigy.=
net">mailto:mirwalds at prodigy.net</A>]</FONT>
<BR><FONT SIZE=3D2>Sent: Tuesday, July 30, 2002 4:43 PM</FONT>
<BR><FONT SIZE=3D2>To: EUforum</FONT>
<BR><FONT SIZE=3D2>Subject: Re: System Ping (to resolve DNS)</FONT>
</P>
<BR>

<P><FONT SIZE=3D2>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The Euphoria Mailing=
 List =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D </FONT>
</P>

<P><FONT SIZE=3D2>Actually, if you go to <A HREF=3D"http://pages.prodigy.ne=
t/mirwalds/" TARGET=3D"_blank">http://pages.prodigy.net/mirwalds/</A> you w=
ill find</FONT>
<BR><FONT SIZE=3D2>tcp.ew on the page. It includes heaps.e and structs.e (b=
oth by Chris</FONT>
<BR><FONT SIZE=3D2>Bensler) to handle the memory operations, but it wraps t=
he Async versions of</FONT>
<BR><FONT SIZE=3D2>both gethostbyname() and gethostbyaddr().</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp;It does handle alot of the painfull stuff for Async=
 lookups, and I believe</FONT>
<BR><FONT SIZE=3D2>that the libs are all compatable with win32lib.</FONT>
</P>

<P><FONT SIZE=3D2>The zip file itself is here: <A HREF=3D"http://pages.prod=
igy.net/mirwalds/tcp.zip" TARGET=3D"_blank">http://pages.prodigy.net/mirwal=
ds/tcp.zip</A></FONT>
</P>

<P><FONT SIZE=3D2>Jason</FONT>
</P>

<P><FONT SIZE=3D2>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>
<BR><FONT SIZE=3D2>This email was sent to: mdmoran at kpmg.ca</FONT>
</P>

<P><FONT SIZE=3D2>EASY UNSUBSCRIBE click here: <A HREF=3D"http://topica.com=
/u/?b1dd66.b269fb" TARGET=3D"_blank">http://topica.com/u/?b1dd66.b269fb</A>=
</FONT>
<BR><FONT SIZE=3D2>Or send an email to: EUforum-unsubscribe at topica.com</FON=
T>
</P>

<P><FONT SIZE=3D2>T O P I C A -- Register now to manage your mail!</FONT>
<BR><FONT SIZE=3D2><A HREF=3D"http://www.topica.com/partner/tag02/register"=
 TARGET=3D"_blank">http://www.topica.com/partner/tag02/register</A></FONT>
<BR><FONT SIZE=3D2>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT>
</P>

<CODE><FONT SIZE=3D3><BR>
<BR>
***************************************************************************=
***<BR>
The information in this email is confidential and may be legally privileged=
.<BR>
It is intended solely for the addressee. Access to this email by anyone els=
e<BR>
is unauthorized.<BR>
 <BR>
If you are not the intended recipient, any disclosure, copying, distributio=
n<BR>
or any action taken or omitted to be taken in reliance on it, is prohibited=
<BR>
and may be unlawful. When addressed to our clients any opinions or advice<B=
R>
contained in this email are subject to the terms and conditions expressed i=
n<BR>
the governing KPMG client engagement contract.<BR>
***************************************************************************=
***<BR>
</FONT></CODE>
------_=_NextPart_001_01C23827.5197FB70--

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

4. RE: System Ping (to resolve DNS)

On 30 Jul 2002, at 20:15, Mark Moran wrote:

> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
> 
> ------_=_NextPart_001_01C23827.5197FB70
> 
> 
> Aw ya... that's exactly what I needed :)  Thanks again Jason!
> 
> Hey Kat... check this out... it certainly does what we're needing.  (What
> I'm needing anyway)

Can you get past this msg?:

D:\Euphoria\tcp-e\tcp_demo.exw:26
setHandler has not been declared
setHandler(getHost,w32HClick,routine_id("onClick_getHost"))
         ^

Warning: parameter id in onClick_getHost() is not used
Warning: parameter event in onClick_getHost() is not used


Press Enter...

Kat

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

5. RE: System Ping (to resolve DNS)

On 30 Jul 2002, at 22:49, Mark Moran wrote:

> 
> So Kat, I'm curious...
> 
> How do <i>you</i> resolve names to numeric IP's?

dns.ew

Umm,, or dns.e , depending on where you read... but it's PatRat's (Thomas 
Parslow). It's this easy:

include D:\Euphoria\DNS\dns.ew
include get.e

object junk

puts(1,dns_DNSToIP("kechara.sorcery.net"))

junk = wait_key()

Kat

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

6. RE: System Ping (to resolve DNS)

>
>Can you get past this msg?:
>
>D:\Euphoria\tcp-e\tcp_demo.exw:26
>setHandler has not been declared
>setHandler(getHost,w32HClick,routine_id("onClick_getHost"))
>          ^
>
>Warning: parameter id in onClick_getHost() is not used
>Warning: parameter event in onClick_getHost() is not used
>
>
>Press Enter...
>
>Kat
>

Looks like you need a new version of Win32Lib. According to the list of 
Win32Lib changes, it was introduced in version 0.57+. It is definetaly 
faster then onClick[] and others. You can also specify multiple handlers per 
event.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu