vb.net多网卡监听的简单介绍-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

vb.net多网卡监听的简单介绍

目前哪些网卡是支持监听的?

网卡都有监听功能,只要安装合适的软件就能启动监听,不过使用这一类软件时,必须遵守有关规定,不得损害他人权益。

成都创新互联专注为客户提供全方位的互联网综合服务,包含不限于做网站、成都网站制作、古塔网络推广、小程序制作、古塔网络营销、古塔企业策划、古塔品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们最大的嘉奖;成都创新互联为所有大学生创业者提供古塔建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.com

电脑有两张网卡。如何用vb.net分别获取网卡的IP?求大神明路!

'要使得引用System.Management有效,先通过菜单

'[项目]--[添加引用],在“.Net”选项卡里,选择“System.Management”,单击[确定]

Imports System.Management

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim MySearcher As New ManagementObjectSearcher("SELECT * FROM Win32_NetworkAdapterConfiguration")

For Each MySearcherObj As ManagementObject In MySearcher.Get

If CBool(MySearcherObj("IPEnabled")) Then

MsgBox(MySearcherObj("IPAddress")(0))

End If

Next

End Sub

End Class

vb.net 检测网络连接

既然从网上找的实例没问题,也许就是调用的时候没出来或者在检测网卡当中出现了问题。

.net程序监听指定网卡

利用指定进程的/proc/pid/net/dev文件,来统计该进程在每个网卡上的收发流量。

用vb.net实现网络通信

用 vb.net socket通信

Dim th As Threading.Thread

2 Dim tcpl As System.Net.Sockets.TcpListener

3

4 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

5 th = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf MyListen))

6 th.Start()

7 End Sub

8

9 Public Sub SendMessage()Sub SendMessage(ByVal IP As String, ByVal SendMsg As String)

10 Try

11 If IP "" Then

12 Dim tcpc As New System.Net.Sockets.TcpClient(IP, 5656)

13 Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream

14 Dim reqStream As New IO.StreamWriter(tcpStream)

15 reqStream.Write(SendMsg)

16 reqStream.Flush()

17 tcpStream.Close()

18 tcpc.Close()

19 End If

20 Catch ex As Exception

21 MsgBox(ex.Message.ToString)

22 End Try

23 End Sub

24 Private Sub MyListen()Sub MyListen()

25 Try

26 Dim ipAddress As System.Net.IPAddress = System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0)

27 tcpl = New System.Net.Sockets.TcpListener(ipAddress, 5656)

28 tcpl.Start()

29 While True

30 Dim s As System.Net.Sockets.Socket = tcpl.AcceptSocket()

31 Dim MyBuffer(1024) As Byte

32 Dim i As Integer

33 i = s.Receive(MyBuffer)

34 If i 0 Then

35 Dim lstrRec As String

36 Dim j As Integer

37 For j = 0 To i - 1

38 TextBox1.Text += Chr(MyBuffer(j)) ","

39 Next

40 End If

41 End While

42 Catch ex As Exception

43 MsgBox(ex.Message.ToString)

44 End Try

45 End Sub

46

47 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

48 SendMessage("192.168.0.61", TextBox2.Text)

49 End Sub

vb.net 获取指定网卡的网络连接状态

.net不能获得【指定】网卡的信息,给个思路,先遍历所有网卡,然后找到你需要的的那个网卡的信息。


网站栏目:vb.net多网卡监听的简单介绍
标题链接:http://kswsj.cn/article/hphchs.html

其他资讯