Announcement

Collapse
No announcement yet.

How to lookup WINS hostname from IP address?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to lookup WINS hostname from IP address?

    In my VB6 plugin I have the IP address (eg 10.1.1.20) from the incomming winsock connection of the machine that sent me the TCP/IP message. I've looked but I can't find, in any of the Winsock documentation, anything that will allow me to reverse lookup the computer name of the machine that sent me the message. Instead of a winsock function this may be a windows thing.

    Does anyone know what the proper way to lookup the WINS computer name of a machine if you know it's IP address? Any example/sample code would be greatly appreciated.

    Thanks,
    George

    #2
    Look for the DNS resolver function GetHostByAddress(). This function should not only check WINS, but also DNS.

    Here is the same code you requested:
    http://www.mvps.org/vbnet/index.html.../ipaddress.htm
    Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

    Comment


      #3
      Ultra,

      Thanks, exactly what I was looking for and I also didn't know about that web site. It looks like a great resource for tips and tricks.

      One more question, if I added this to my project, would this be a good example of when to use a class module? Would this best be implemented as a class?

      I'm still a little unclear as to when things should be classes and things should be modules.

      George

      Comment


        #4
        <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by George Photakis:
        ...
        One more question, if I added this to my project, would this be a good example of when to use a class module? Would this best be implemented as a class?
        ...
        George<HR></BLOCKQUOTE>

        A class module allows you to create it as a object, where a module doesn't. They will both work, it just depends on your coding style.
        Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

        Comment


          #5
          Great thanks, I played with it and it worked just fine as a class module. It gave me some practice creating one.

          Actually the code from the site worked almost unchanged. All I had to do is change the msgbox's to internal debug statements and change the Public Function to a Friend Function.

          With this and some other inspirations I've had, I'm going a little nuts in my hsGirder plugin. I've added about 20K in code just in the past couple days. I guess I'm dangerous when I've got some free time on my hands.

          George

          Comment

          Working...
          X