read IP address

2,646 views
Skip to first unread message

kirk

unread,
Jul 31, 2007, 3:06:29 AM7/31/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I have simply point to point network. Assumed that is possible to know
MAC address of remote machine. It's possible to get also IP static
address ?

Sammy Lin

unread,
Jul 31, 2007, 4:23:20 PM7/31/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
kirk,
you might want to elaborate more about the application and how they're
connecting. Im alittle confused about what you're asking.

Alexander Higgins

unread,
Aug 1, 2007, 8:34:31 PM8/1/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Ok you need to get the IP addres of a remove computer using .net..
Humm probably not the right way to do it but here is how I would do it
(not tested but it should work). Call Arp from the commandline and
pipe the results to a text file. Then read the text file line by line
looking for the Mac address. If the IP is on the same line as the Make
address then return the IP


function getIpFromMacaddress
Dim TempFile = "C:\somefile.txt")
Dim macAddress = "0-aa-00-62-c6-09"
if io.file.exists(tempfile) then io.file.delete(tempfile)
Dim shell = createobject("wscipt.shell")
shell.run(string.format("cmd /c arp -a >> " & tempfile)
Dim sr as new io.streamreader(Tempfile)
dim s as string = sr.readtoend
sr.close
Dim lines as string = split(s, vbnewline)
for i as integer=0 to line.length-1
if line(i).indexof(macAddress) <> -1 then
return split(line, vbtab)(0).trim
end if
next
return "Ip not found"
end function

> > address ?- Hide quoted text -
>
> - Show quoted text -

kirk

unread,
Aug 1, 2007, 6:09:28 PM8/1/07
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Thanks you Sammy, Sorry English is not my native language. I try to
explain better. I have a embedded machine ( like PC104 ) with ethernet
connection. I open socket connection throught TCP/IP and I can send
and receive message all is ok. But with TCP I need to know IP address
before. In my application this information will be easly losed. Is
there anybody that tryed to know remote IP address. Consider that I
have always simply connection one embedded machine linked with one PC.
Thanks a lot for any suggest...
Reply all
Reply to author
Forward
0 new messages