network send text

slydog43

Member
Licensed User
Longtime User
Im trying to send some text to an open port.
I can open the socket but then Im confused

I have
Sub mySocket1_Connected (Successful As Boolean)

If Successful = False Then
Return
Else
Msgbox("connected!","")
End If

Dim tw As TextWriter
tw.Initialize(mySocket1.OutputStream)

tw.WriteLine("testing 123")


is this close?
 

fabianr

Member
Licensed User
Longtime User
How to send data? (Network)

I am tried make an application client/server. The Server is done in Delphi, and the Client en Basic4Android.

My Question is how to send data for than the server receive the data and for example do an action according to the text sent.

My Client:

B4X:
Sub Process_Globals
    Dim Socket1 As Socket   
End Sub

Sub Globals
Dim Button1 As Button

End Sub 

Sub Activity_Create(FirstTime As Boolean)
activity.LoadLayout("Ventana1")
    Socket1.Initialize("Socket1")
    Socket1.Connect("192.168.1.4",8721,20000)
End Sub

Sub Socket1_Connected (Successful As Boolean)
    If Successful = False Then
        Msgbox(LastException.Message, "Error connecting")
        Return
    End If
   
End Sub

Sub Button1_Click
'[B]HERE IS THE CODE YOU SHOULD SEND THE TEXT[/B]
End Sub

:sign0085:
Gracias.
 
Upvote 0

fabianr

Member
Licensed User
Longtime User
I do not understand ... but anyway the example is an application out there
server right? and the client? :/
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…