سلام
چطور توی VB.net میتونم Ip های کل کامپیوتر های شبکه رو پیدا کنم
lممنونم از جوابتون
Imports System.Net.NetworkInformation
Imports System.Text
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ipgProps As IPGlobalProperties
Dim tcpCons() As TcpConnectionInformation
Dim s As New StringBuilder
ipgProps = IPGlobalProperties.GetIPGlobalProperties()
tcpCons = ipgProps.GetActiveTcpConnections()
For Each item As TcpConnectionInformation In tcpCons
s.AppendLine(String.Format("{0} {1}", item.LocalEndPoint, item.RemoteEndPoint))
Next
MessageBox.Show(s.ToString())
End Sub
End Class
ممنونم از جوابتون
منظورم شبکه محلی بود
Imports System.Text
Imports System.Net
Imports System.IO
Imports System.Diagnostics
Dim line As String = ""
Dim s As New StringBuilder
Dim ip As String
Dim name As String
Using netUtility As New Process
With netUtility.StartInfo
.FileName = "net.exe"
.Arguments = "view"
.CreateNoWindow = True
.RedirectStandardOutput = True
.RedirectStandardError = True
.UseShellExecute = False
End With
netUtility.Start()
Using streamReader As New StreamReader( _
netUtility.StandardOutput.BaseStream _
, netUtility.StandardOutput.CurrentEncoding)
Do
line = streamReader.ReadLine()
If line Is Nothing Then
Exit Do
End If
If line.StartsWith("\\") Then
name = line.Substring(0, line.IndexOf(" ")).Substring(2)
ip = ""
Try
Dim host As IPHostEntry = Dns.GetHostEntry(name)
For Each item As IPAddress In host.AddressList
If item.AddressFamily = Sockets.AddressFamily.InterNetwork Then
ip = item.ToString()
Exit For
End If
Next
Catch ex As Exception
End Try
s.AppendLine(String.Format("{0}{1} {2}", name, vbTab, ip))
End If
Loop
End Using
End Using
MessageBox.Show(s.ToString())