'引用DSAPI
Private WithEvents 设备 As New DSAPI.网络.Socket传输_Tcp.客户端
Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
设备.断开()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
With 设备
.端口 = 9999
.服务端IP = "127.0.0.1"
.字节最大长度 = 14
.启动()
End With
End Sub
Private Sub 设备_出错(出错信息 As String) Handles 设备.出错
Console.WriteLine("发生错误:" & 出错信息)
End Sub
Private Sub 设备_断开连接() Handles 设备.断开连接
Console.WriteLine("与设备的连接已断开")
End Sub
Private Sub 设备_服务端连接成功() Handles 设备.服务端连接成功
Console.WriteLine("与设备成功连接")
End Sub
Private Sub 设备_连接超时() Handles 设备.连接超时
Console.WriteLine("连接设备超时")
End Sub
Private Sub 设备_收到消息(Bts() As Byte) Handles 设备.收到消息
Console.WriteLine(BitConverter.ToString(Bts))
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim CMD As String = "FF FB 11 22 33"
CMD &= DSAPI.串口通讯.附加功能.获取CRC校验值(CMD)
设备.发送消息(DSAPI.串口通讯.附加功能.十六进制字串转字节(CMD))
End Sub
这个是我网上找的TCPIP收发信息,能不能用在狐表i上?怎么用?