📄 sync.vb
字号:
Imports System.Net
Imports System.Net.Sockets
Public Class Sync
Const portNo As Integer = 3456
Dim client As Socket
Public Sub PerformSync( _
ByVal HostIP As String, _
ByVal txtData As String)
Try
Dim RemoteAdd As System.Net.IPAddress = _
System.Net.IPAddress.Parse(HostIP)
Dim endPoint As New IPEndPoint(RemoteAdd, portNo)
client = New Socket(endPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp)
client.Connect(endPoint)
'---send a message to the server
Dim data As Byte() = _
System.Text.Encoding.ASCII.GetBytes(txtData)
'---send the text---
client.Send(data)
client.Close()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -