1,451
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Sub Command1_Click() '连接'
Winsock1.remoteip = xxx.xxx.xxx.xxx
Winsock1.RemotePort = xxxxx
Winsock1.Connect
End Sub
Private Sub Command2_Click() '发送'
If Winsock1.State = sckConnected Then
Winsock1.SendData "ttt"
Else
MsgBox "状态 " & Winsock1.State & vbCrLf & "不能发送。", vbExclamation
End If
End Sub
Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "错误代码 " & Number & vbCrLf & Description, vbExclamation
End Sub