Android Question Socket not working correctly

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using the Network Library to connect to a hostname & Port and sending messages to it. (using SSL)

In B4A it seems to connect to the device but doesn't return any data, even though it should.

I then used the exact same code in B4J and it connects and I am getting data returned. (it works).

Attached is both projects (sample projects). Any idea why B4A doesn't work where B4J does ?

(I have removed some fields in the code for security reasons.. such as IP, username, passwords etc)

Using B4A Version 5.80 (Running app on Nexus 5 - Android 6.0)
Using B4J Version 4.20 (Running on Windows 10 on Mac)
 

Attachments

  • B4JTest.zip
    2.3 KB · Views: 110
  • B4ATest.zip
    8 KB · Views: 132

aaronk

Well-Known Member
Licensed User
Longtime User
Can you test it without SSL?
No. The device I am connecting to only uses SSL.

I have asked the engineer to view the incoming log at there end and they said it's splitting the opening “{“ and the rest of the json into 2 separate packets.

He said the parser at his end immediately determined both were invalid JSON and threw them away, so my guess is the app is splitting the command somehow when sending it.

Unfortunately the server side (which I am sending the json message to) is already completed and there is another program (not written by me) that is working fine with the device I am send the messages to. So this is telling me it's something I am doing wrong to cause this not to work.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
Anyone have any ideas? I have been trying to work it out but can't work out what is different and why it's splitting the commands when it sends the message.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Tried inserting command,username and so on, in double quotes? Ie, "command":"AuthenticateUser" etc...
 
Upvote 0
Top