Hi guys
I am a hobby programmer, but i have a problem right now that has had me stumped for 3 days now.
I am sending a string to a server and the server is returning an answer.
Everything works nicely, until I close the application.
Then everything crashes.
I have tried everything, but i cant find the problem.
PLEASE HELP
very basic a button to start a timer, wich inturn clocks the send routins every 5 sec.
Receive routine just splits the data and puts it into text fields.
Code:Private Sub cmdCon_Click()
sock.RemoteHost = txtIP.Text
sock.RemotePort = txtPort.Text
sock.Bind
txtIP.Enabled = False
txtPort.Enabled = False
ReadTimer.Enabled = True
cmdCon.Enabled = False
cmdDiscon.Enabled = True
End Sub
--------------------------------------------------------------------------
Private Sub cmdDiscon_Click()
sock.Close
txtIP.Enabled = True
txtPort.Enabled = True
cmdCon.Enabled = True
cmdDiscon.Enabled = False
ReadTimer.Enabled = False
End Sub
--------------------------------------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
If sock.State <> sckClosed Then
sock.Close
End If
End Sub
--------------------------------------------------------------------------
Private Sub ReadTimer_Timer() '5sec timer for sending data
Dim hData As String
txtIP.Text = Trim$(txtIP.Text)
txtPort.Text = Trim$(txtPort.Text)
If Len(txtIP.Text) > 0 And Len(txtPort.Text) > 0 And IsNumeric(txtPort.Text) Then
sock.SendData "\xFE\xFD\" 'data send
End If
End Sub
--------------------------------------------------------------------------
Private Sub sock_DataArrival(ByVal bytesTotal As Long) 'receive data
Dim strData As String
Dim Nato As String
Dim Miles As String
Dim Cheats As String
Dim Official As String
Dim Pb As String
Dim Tourney As String
Dim v As Variant
sock.GetData strData, vbString, bytesTotal
v = Split(strData, "\")
ServerName.Text = v(2)
MapName.Text = v(10)
Players.Text = v(14)
MaxPlayers.Text = v(18)
MissionTime.Text = v(44)
AverageHonor.Text = v(64)
MaxHonor.Text = v(38)
MinHonor.Text = v(36)
AveragePing.Text = v(74)
CurRound.Text = v(42)
AdminName.Text = v(56)
AdminEmail.Text = v(58)
End Sub
