Android Question what is the correct way to send data from android to desktop server

RAYMOND21

Member
hello everyone! need help i am now facing some problem i am currrently programming a cross platform application(server client application) which is the server runs on desktop while client runs on android but i do have other clients also running on desktop, yes i successfuly sent the data from both clients( the desktop clients/ the android) but when i run both clients at the same time the server get stocked until i close the android client and it goes back to work again,


here is the server code on vb.net

' Private Sub listening()

Do Until ISLISTENING = False
If LISTENER.Pending = True Then
SERVER = LISTENER.AcceptTcpClient
SR = New StreamReader(SERVER.GetStream)
End If
Try
REQUESTRECEIVED(SR.ReadLine)
Catch ex As Exception

End Try
Thread.Sleep(100)
Loop


here is the desktop client code:

Try
SERVER = New TcpClient(SERVERIP, 51042)
DS = New StreamWriter(SERVER.GetStream)
DS.Write("ADDTOIP " + MYIP & vbCrLf)
DS.Flush()
DS.Close()
SERVER.Close()
MsgBox("sent")
Catch ex As Exception

End Try


and here is my b4a code:


Public Sub SendData (msg As String)
Dim Buffer() As Byte

Buffer = msg.GetBytes("UTF8")
astream.Write(Buffer)

the android client needs to be disconnected to the server first so that other desktop client can also send data to server
is my desktop client code convertible to b4a?? or something like that so that it behaves accordingly without conflicting with other clients
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…