Private Sub ConnectToServer(Host As String)
Log("Trying to connect to: " & Host)
CloseExistingConnection
client.Initialize("client")
client.Connect(Host, PORT, 10000) ' Host is 192.168.0.233 and PORT is 2008
Wait For client_Connected (Successful As Boolean)
If Successful Then
tcpAStream.InitializePrefix(client.InputStream, False, client.OutputStream, "bluetoothAStream")
tcpStateChanged (True)
Else
Private theEx As Exception = LastException
Log("Failed to connect: " & theEx.Message)
End If
End Sub