vb Code:
FileNumber = FreeFile
sData = ""
Open PoleFolder & MySelectedFile For Input As #FileNumber
Line Input #FileNumber, sData
Close #FileNumber
Kill PoleFolder & MySelectedFile ' Deletes the request file from the Directory
Fields() = Split(sData, ",")
For i = 0 To UBound(Fields)
Fields(i) = ""
Next
Fields() = Split(sData, ",")
For i = 0 To UBound(Fields)
Trim (Fields(i))
Next
If Fields(0) = "Sale" Then
FrmMainScreen.List1.AddItem " Intergrated Sale transaction of £" & Fields(1) & " was recevied"
SendData = vbNullString
SendData = "T,,01,0000,,,,,,," & Format(Fields(1), "######0.00") & ",,,,,,,,,,,," & Fields(2) & "," & AccountID & ",,,," & Chr(13) & Chr(10)
End If
If Fields(0) = "Refund" Then
FrmMainScreen.List1.AddItem " Intergrated Refund transaction of £" & Fields(1) & " was recevied"
Kill PoleFolder & MySelectedFile
SendData = vbNullString
SendData = "T,,02,0000,,,,,,," & Format(Fields(1), "######0.00") & ",,,,,,,,,,,," & Fields(2) & "," & AccountID & ",,,," & Chr(13) & Chr(10)
End If
With FrmMainScreen.ToOcuis
If .State = 8 Then
.Connect IPAddress, ToOcuisPort
End If
Sleep 1500
If .State = 7 Then
.SendData SendData
End If
End With
THIS works the first time but when ever I try to send another sale to the Socket after the first one that is when the error happens.