Android Question [SOLVED] TcpIp ServerSocket wan't receive data from Windows

Lello1964

Well-Known Member
Licensed User
Longtime User
I have an android server service that uses ServerSocket, it receives data using the TCP-ip protocol.

If I connect from an App made with B4A and send the data, it works perfectly.

If I try to send data from Windows using mswinsocket or from a non-B4A andorid App, it gives me the connection but does not receive the data.

??
 

DonManfred

Expert
Licensed User
Longtime User
Absolutely right...

??

How should one help? You are NOT PROVIDING a b4x code, not providing any non b4x code.
The only thing we can do is guessing

Best would be if you provide a testproject (b4a and windowsapp which sends data. Best with source. I don´t see how we could help otherwise ;-)
 
Last edited:
Upvote 0

Lello1964

Well-Known Member
Licensed User
Longtime User
Sorry,

Server use :

B4X:
Sub Process_Globals
    Public server As ServerSocket
    Private client As Socket
    Private AstreamPagamico As AsyncStreams
.......

Private Sub ListenForConnections
    Log("Chiamata TCPip")
    Do While working
        server.Listen
        Wait For server_NewConnection (Successful As Boolean, NewSocket As Socket)
     
        If Successful Then
            CallSub(Main, "SetState")
            client = NewSocket
            Astream.InitializePrefix(client.InputStream, False, client.OutputStream, "Astream")

..................


Client :

using MsWindowsSocket
.
thisform.tcpIP.object.Protocol=0


thisform.tcpIP.object.RemotePort=2100
thisform.tcpIP.object.connect("192.168.1.162",2100)

MessageBox(THISFORM.TCPIP.OBJECT.STate)

If Thisform.TCPIP.STate < 7
Messagebox("chiudo")
Thisform.TCPIP.Object.Close()
Cancel
Exit

Endif

Thisform.TCPIP.OBJECT.SendData( "aa" )

I 've also tryed to send data using Tcp-Ip Client from PlayStore.

If i receive from Wiindows Sever, i wil receive data from allk.

But using B4a Server, from B4A client receive data, but from Windows and non B4A Android app connection ok, but no data received.

I don't know why ?

I'm trying from yesterday but no solution.
 
Upvote 0

Lello1964

Well-Known Member
Licensed User
Longtime User
Thanks to @Star-Dust

Astream.InitializePrefix(client.InputStream, False, client.OutputStream, "Astream")

instead of

Astream.Initialize(client.InputStream, client.OutputStream, "Astream")
 
Upvote 0
Top