[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 :wave:
I hope someone can help me with this !
Thx a lot :thumb:
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:
shell "PING -a xxx.xxx.xxx.xxx"
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:
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.
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
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 :)
Re: [winsock] Getting the machine name on which I'm connected
hi try this:
VB Code:
dim localpc as string
localpc = environ("computername")
Re: [winsock] Getting the machine name on which I'm connected
Quote:
Originally Posted by nvierros
hi try this:
VB Code:
dim localpc as string
localpc = environ("computername")
environ can be changed, dont use it.