socket you receive

diresc

Member
Licensed User
Longtime User
Dim tw As TextWriter
Dim tr As TextReader
Dim InputStream1 As InputStream
Dim OutputStream1 As OutputStream
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

tr.Initialize(Socket1.InputStream)
tw.Initialize(Socket1.OutputStream)
tw.WriteLine(COMPILATO.Text)
tw.Flush

Dim line As String
line = tr.ReadLine '''error pause in Debug
Do While line <> Null
Log(line)
line = tr.ReadLine
Loop
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
error:java.net.socketexception:bad file number ??????

paths configuration
C:\Programmi\Java\jdk1.6.0_26\bin\javac.exe
C:\Programmi\Android\android-sdk\platforms\android-8\android.jar
Basic4Android :version 1.70
 
Last edited:

poseidon

Member
Licensed User
Longtime User
re

or by

B4X:
Sub Process_Globals
    Dim Socket1 As Socket
End Sub

Sub Globals

End Sub 

Sub Activity_Create(FirstTime As Boolean)
    Socket1.Initialize("Socket1")
    Socket1.Connect("nist1-ny.ustiming.org" , 13, 20000)
End Sub

Sub Socket1_Connected (Successful As Boolean)
    If Successful = False Then
        Msgbox(LastException.Message, "Error connecting")
        Return
    End If
    Dim tr As TextReader
    tr.Initialize(Socket1.InputStream)
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append(tr.ReadLine) 'read at least one line
    Do While tr.Ready
        sb.Append(CRLF).Append(tr.ReadLine)
    Loop
    Msgbox("Time received: " & CRLF & sb.ToString, "")
    Socket1.Close
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…