Re: DNS Lookup

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

Hi Thomas

A check of the function says that it returns a pointer.

The Euphoria doc's say

"However the distinction between signed and unsigned may be important
when you specify the return type of a function."

The Eu doc's define C_POINTER = C_ULONG

Perhaps you could try changing the type returned by the c function in your
defininition to C_POINTER or C_ULONG??

eg

gethostbyname =  define_c_func(WSOCK32,"gethostbyname",{C_LONG},C_POINTER)


Cheers

Mark


> I'm trying to do a DNS lookup using the winsock function GetHostByName, in
> Visual Basic the following works:
>
> Declare Function GetHostByName Lib "wsock32.dll" Alias "gethostbyname"
> (ByVal sHostName As String) As Long
>
> In Euphoria I tried this:
>
> constant WSOCK32 = open_dll("wsock32.dll")
> atom gethostbyname
> gethostbyname =  define_c_func(WSOCK32,"gethostbyname",{C_LONG},C_LONG)
> memDNS = allocate_string("www.infoseek.com")
> ? c_func(gethostbyname,{memDNS})
> free(memDNS)
>
> But it just returns 0, can any one see what I'm doing wrong here?
> Thomas Parslow (PatRat) ICQ #:26359483
> Rat Software
> http://www.ratsoft.freeserve.co.uk/
>
> Get paid to surf the web!
> http://members.tripod.co.uk/paid2surf/

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

Search



Quick Links

User menu

Not signed in.

Misc Menu