Continuing on
Ok since posting my original post last night I was able to make some headway using the asyncstreamstext example. Below is the code as I have it right now. Everything is working except when I send the string from my visual basic program it goes immediately to Sub ast_Terminated. I have tried adding CRLF to the end of my string in VB as well as just CR. I added the asyncstreamstext.bas module into my program. Seems like it should work but i am missing one little thing. :sign0085::BangHead:
Sub Process_Globals
Private ast As AsyncSteamsText
Private server As ServerSocket
End Sub
Sub Globals
Dim EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
server.Initialize(5500, "server")
Log(server.GetMyWifiIP)
server.Listen
End If
EditText1.Initialize("EditText1")
EditText1.ForceDoneButton = True
Activity.AddView(EditText1, 10dip, 10dip, 300dip, 60dip)
End Sub
Sub Server_NewConnection (Successful As Boolean, NewSocket As Socket)
If Successful Then
EditText1.Text = "Connected"
If ast.IsInitialized Then ast.Close
ast.Initialize(Me, "ast", NewSocket.InputStream, NewSocket.OutputStream) 'initialize AsyncStreamsText with the socket streams.
End If
server.Listen
End Sub
Sub ast_NewText(Text As String)
Log("Text: " & Text)
Log(Text.Length)
EditText1.Text = Text
End Sub
Sub ast_Terminated
EditText1.text = "Failed"
Log("Connection terminated")
End Sub