Results 1 to 7 of 7

Thread: [winsock] Getting the machine name on which I'm connected

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    2

    Question [winsock] Getting the machine name on which I'm connected

    Hi Guys,

    First of all..
    HELLO to the community !!

    I have a question:

    I connect to a pc via winsock.connect
    And I only know the ip of this pc. (winsock.RemoteHost = " 192.168.2.99 ")
    How can I get the machine name ??

    Sorry for my bad english...I'm german

    I hope someone can help me with this !

    Thx a lot

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: [winsock] Getting the machine name on which I'm connected

    Welcome to the forums!

    I know you can resolve names on the internet with this:
    VB Code:
    1. shell "PING -a xxx.xxx.xxx.xxx"

  3. #3
    Fanatic Member modpluz's Avatar
    Join Date
    Sep 2005
    Location
    Lag, NG
    Posts
    633

    Re: [winsock] Getting the machine name on which I'm connected

    now the 'resolve names' i think it only works when working on an internet related project even though i don't understand the.

    VB Code:
    1. shell "PING -a xxx.xxx.xxx.xxx"


    the get machine name thing, i dont know how to do it from the server but this is the trick i used;

    each time the client sends a message to the server it gets the machine name and send along with it.

    fine i don't know about others but this seems a little more complicated.
    Last edited by modpluz; Oct 17th, 2005 at 11:15 AM.
    If you want the rabbit to hop, move the carrot - Paul Kellerman(Prison Break)

    onError GoTo http://vbforums.com



    My Bits:
    VB6: Change Column Name in MS ACCESS

  4. #4
    New Member
    Join Date
    Oct 2002
    Location
    Saudi Arabia
    Posts
    8

    Re: [winsock] Getting the machine name on which I'm connected

    You need to do a DNS reverse lookup. There is a third party control to do that: http://www.dart.com/dns.asp
    Yet, with a bit more searching on the net, you will certainly a free solution via the windows API.
    From the command prompt nbtstat -a xxx.xxx.xxx.xxx (Where the xxx are the IP address)
    Also from command prompt: nslookup

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2005
    Posts
    2

    Re: [winsock] Getting the machine name on which I'm connected

    Thanks for the answers.

    I've found some API funktions
    GetHostByName() and
    GetHostByIp()

    They have also solved my problem

  6. #6
    Lively Member nvierros's Avatar
    Join Date
    Nov 2005
    Location
    Melbourne, Australia
    Posts
    110

    Re: [winsock] Getting the machine name on which I'm connected

    hi try this:


    VB Code:
    1. dim localpc as string
    2.  
    3. localpc = environ("computername")

  7. #7
    Admodistrator |2eM!x's Avatar
    Join Date
    Jan 2005
    Posts
    3,900

    Re: [winsock] Getting the machine name on which I'm connected

    Quote Originally Posted by nvierros
    hi try this:


    VB Code:
    1. dim localpc as string
    2.  
    3. localpc = environ("computername")
    environ can be changed, dont use it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width