Private Sub Form_Load()
Winsock1.RemotePort = 22222
Winsock1.Protocol = sckUDPProtocol
End Sub
Private Sub Command1_Click()
Command1.Enabled = False
Dim sendBuff As String
sendBuff = "XXXXX"
Label1:
On Error GoTo Label2
Winsock1.RemoteHost = "andon-eds-1"
Winsock1.SendData sendBuff
Label2:
Winsock1.Close
Winsock1.Protocol = sckUDPProtocol
Winsock1.RemotePort = 22222
Winsock1.LocalPort = 0
Label3:
On Error GoTo EndOfSub
Winsock1.RemoteHost = "andon-eds-1"
Winsock1.SendData sendBuff
EndOfSub:
Command1.Enabled = True
End Sub
Private Sub Command2_Click()
Command2.Enabled = False
On Error GoTo EndOfSub
Winsock1.RemoteHost = "andon-eds-1"
Winsock1.SendData "XXXXX"
EndOfSub:
Command2.Enabled = True
End Sub
Private Sub Command3_Click()
On Error Resume Next
Command3.Enabled = False
Dim sendBuff As String
sendBuff = "XXXXX"
PrintWinsockProperty
Winsock1.RemoteHost = "andon-eds-1"
Winsock1.SendData sendBuff
PrintWinsockProperty
Winsock1.Close
Winsock1.Protocol = sckUDPProtocol
Winsock1.RemotePort = 22222
Winsock1.LocalPort = 0
PrintWinsockProperty
Winsock1.RemoteHost = "andon-eds-1"
Winsock1.SendData sendBuff
PrintWinsockProperty
Command3.Enabled = True
End Sub
'the host name "andon-eds-1" is not online and i want my application can continues
- when i click Command1 i found an error Invalid Argument : 10014
at >>Winsock1.SendData sendBuff << below Label3 my application cannot continues - when i click Command2 2 times it can continues without application close
when i click Command3 it can continues without application close
my question are what's the difference between 1.) and 2.) ? and
what's difference between On Error Resume Next and On Error GoTo for my problem ?
(** i'm sorry about my english skills)
thanksPrivate Sub Command6_Click() Dim i As Integer Command6.Enabled = False On Error GoTo BeginLoop Winsock1.RemoteHost = "Andon-eds-1" Winsock1.SendData "XXXXX" BeginLoop: Resume Next For i = 0 To 2 Winsock1.RemoteHost = "Andon-eds-" & i Winsock1.SendData "XXXXX" Debug.Print Err.Number '0 '0 '0 Next On Error GoTo TestLabel i = 100 / 0 Command6.Enabled = True Exit Sub TestLabel: End Sub