07-31-2006 10:52 AM
08-01-2006 08:41 AM
I have not seen a direct function to resolve a url name to an IP address withing CVI. I can think of a couple of options if you do not want to use TCP for your application:
If the target will accept a tcp connection you could establish a link using ConnectToTCPServer() and then use GetHostTCPSocketHandle() and get the IP from the socket structure. You could then kill the TCP link and use the IP for your UDP socket connection.
Another option would be to implement a DomainNameServer (DNS) query directly using UDP. DNS is a UDP based protocol, so it should be very practical to do a DNS lookup directly from UDP. I have never needed to do this, but there may be sample code for an implementation available on the internet.
There are also windows SDK functions that can be used to access DNS lookup. If you have the CVI FDS and are comfortable with the MSDN web site, that is another route to take.
08-02-2006 01:21 AM
I looked a little bit into UDP.fp which is based on winsock. I also found an example in MSDN that does directly what i needed. The link is here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/gethostbyname_2.asp
With this knowledge I extended the UDP.fp accordingly and it works fine.
The only thing to know is that you have to open the winsock library first using WSAStartup() before you can resolve a URL name to an IP address. This was done in UDP.fp during the UDPOpen() call. I have separated this to allow DNS lookups before opening the actual socket.
If you are interested in my modified UDP.fp, please let me know.
08-02-2006 07:24 AM