Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("tcpPrinterTest")
If ASocket.IsInitialized=False Then
ASocket.Initialize("ASocket")
End If
If aUDP.IsInitialized=False Then
aUDP.Initialize("UDP",0,1024)
End If
End Sub
Sub cmdConnect_Click
'just added this If then and everything works correctly now
'must have missed the details that initializing was required again after a close
If ASocket.IsInitialized=False Then
ASocket.Initialize("ASocket")
End If
ASocket.Connect(txtServer.Text,txtPort.Text,5000)
End Sub
Sub ASocket_Connected (Successful As Boolean)
If Successful Then
cmdConnect.Enabled=False
cmdDisconnect.Enabled=True
cmdCut.Enabled=True
cmdESC.Enabled=True
AOutputStream=ASocket.OutputStream
End If
Log(LastException)
End Sub
Sub cmdDisconnect_Click
cmdConnect.Enabled=True
cmdDisconnect.Enabled=False
cmdCut.Enabled=False
cmdESC.Enabled=False
Log(LastException)
ASocket.Close
Log(LastException)
AOutputStream=Null
End Sub