ParseJson crashes

crash app when the text has length more than 4096.

Please file a bug report in Feedback with a sample project.

Sorry, the problem is on the tcpsocket :
I send this :
{“Lista”:[{“op”:“2”,“id”:“1”,“nm”:“Loja de venda”,“v1”:“390”,“v2”:“421”,“v3”:“421”,"%":"-7,36%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“2”,“nm”:“Morro Agudo”,“v1”:“1.311”,“v2”:“2.039”,“v3”:“2.039”,"%":"-35,7%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“3”,“nm”:“Araraquara Setor II”,“v1”:“749”,“v2”:“996”,“v3”:“996”,"%":"-24,8%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“4”,“nm”:“Matao Setor I”,“v1”:“121”,“v2”:“190”,“v3”:“190”,"%":"-36,32%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“5”,“nm”:“Jaboticabal Setor I”,“v1”:“5.463”,“v2”:“6.788”,“v3”:“6.788”,"%":"-19,52%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“6”,“nm”:“Guariba Setor I”,“v1”:“676”,“v2”:“746”,“v3”:“746”,"%":"-9,38%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“7”,“nm”:“Franca”,“v1”:“3.205”,“v2”:“3.936”,“v3”:“3.936”,"%":"-18,57%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“8”,“nm”:“So Carlos”,“v1”:“1.519”,“v2”:“1.814”,“v3”:“1.814”,"%":"-16,26%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“9”,“nm”:“Guariba Setor II”,“v1”:“659”,“v2”:“978”,“v3”:“978”,"%":"-32,62%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“10”,“nm”:“Ituverava”,“v1”:“1.963”,“v2”:“2.623”,“v3”:“2.623”,"%":"-25,16%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“11”,“nm”:“Jaboticabal Setor II”,“v1”:“1.636”,“v2”:“2.184”,“v3”:“2.184”,"%":"-25,09%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“12”,“nm”:“Matao Setor II”,“v1”:“100”,“v2”:“116”,“v3”:“116”,"%":"-13,79%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“13”,“nm”:“Leme”,“v1”:“5.609”,“v2”:“7.071”,“v3”:“7.071”,"%":"-20,68%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“14”,“nm”:“Araraquara Local”,“v1”:“1.313”,“v2”:“1.642”,“v3”:“1.642”,"%":"-20,04%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“15”,“nm”:“Ribeirao Preto Setor I”,“v1”:“201”,“v2”:“197”,“v3”:“197”,"%":“2,03%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“16”,“nm”:“Ribeirao Preto Setor II”,“v1”:“59”,“v2”:“38”,“v3”:“38”,"%":“55,26%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“17”,“nm”:“Ituverava II”,“v1”:“172”,“v2”:“233”,“v3”:“233”,"%":"-26,18%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“18”,“nm”:“Amrico Brasiliense”,“v1”:“2.814”,“v2”:“3.621”,“v3”:“3.621”,"%":"-22,29%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“19”,“nm”:“Tadeu”,“v1”:“416”,“v2”:“381”,“v3”:“381”,"%":“9,19%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“20”,“nm”:“Matao Setor IV”,“v1”:“13”,“v2”:“12”,“v3”:“12”,"%":“8,33%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“21”,“nm”:“Ricardo Araras”,“v1”:“140”,“v2”:“104”,“v3”:“104”,"%":“34,62%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“22”,“nm”:“Ribeirao Preto Local”,“v1”:“1.568”,“v2”:“1.958”,“v3”:“1.958”,"%":"-19,92%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“23”,“nm”:“Ribeirao Preto Local II”,“v1”:“3.854”,“v2”:“4.731”,“v3”:“4.731”,"%":"-18,54%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“25”,“nm”:“Batatais”,“v1”:“1.253”,“v2”:“1.608”,“v3”:“1.608”,"%":"-22,08%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“26”,“nm”:“Barretos”,“v1”:“4.532”,“v2”:“5.712”,“v3”:“5.712”,"%":"-20,66%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“27”,“nm”:“Porto Ferreira”,“v1”:“5.647”,“v2”:“5.850”,“v3”:“5.850”,"%":"-3,47%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“28”,“nm”:“Pontal”,“v1”:“159”,“v2”:“275”,“v3”:“275”,"%":"-42,18%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“29”,“nm”:“Marcos Rio Claro”,“v1”:“1.465”,“v2”:“706”,“v3”:“706”,"%":“107,51%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“30”,“nm”:“Bonfim Paulista”,“v1”:“139”,“v2”:“165”,“v3”:“165”,"%":"-15,76%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“31”,“nm”:“Taquaritinga”,“v1”:“911”,“v2”:“1.061”,“v3”:“1.061”,"%":"-14,14%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“32”,“nm”:“Ziza”,“v1”:“732”,“v2”:“511”,“v3”:“511”,"%":“43,25%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“33”,“nm”:“Carlinhos”,“v1”:“305”,“v2”:“217”,“v3”:“217”,"%":“40,55%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“34”,“nm”:“Antnio Carlos”,“v1”:“552”,“v2”:“481”,“v3”:“481”,"%":“14,76%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“35”,“nm”:“Marco Leme”,“v1”:“1.478”,“v2”:“601”,“v3”:“601”,"%":“145,92%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“36”,“nm”:“Adilson”,“v1”:“1.071”,“v2”:“0”,“v3”:“0”,"%":“inf,%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“37”,“nm”:“Ribeirao Preto Local III”,“v1”:“1.309”,“v2”:“995”,“v3”:“995”,"%":“31,56%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“38”,“nm”:“Maria Helena”,“v1”:“51”,“v2”:“80”,“v3”:“80”,"%":"-36,25%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“39”,“nm”:“Ribeirao Preto Local IV”,“v1”:“124”,“v2”:“160”,“v3”:“160”,"%":"-22,5%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“40”,“nm”:“Sandro”,“v1”:“519”,“v2”:“656”,“v3”:“656”,"%":"-20,88%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“41”,“nm”:“Fbio”,“v1”:“89”,“v2”:“71”,“v3”:“71”,"%":“25,35%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“42”,“nm”:“Andr”,“v1”:“381”,“v2”:“361”,“v3”:“361”,"%":“5,54%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“43”,“nm”:“Z Maria”,“v1”:“184”,“v2”:“216”,“v3”:“216”,"%":"-14,81%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“44”,“nm”:“Loja Vendedor 10%”,“v1”:“315”,“v2”:“373”,“v3”:“373”,"%":"-15,55%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“46”,“nm”:“Vinicius”,“v1”:“266”,“v2”:“0”,“v3”:“0”,"%":“inf,%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“47”,“nm”:“Estr”,“v1”:“1”,“v2”:“0”,“v3”:“0”,"%":“inf,%”,“su”:“1”,“dt”:""}],“Banco”:{“Conectado”:“Ok”,“Mensagem”:“Conectado com sucesso”}}

And receive this :
{“Lista”:[{“op”:“2”,“id”:“1”,“nm”:“Loja de venda”,“v1”:“390”,“v2”:“421”,“v3”:“421”,"%":"-7,36%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“2”,“nm”:“Morro Agudo”,“v1”:“1.311”,“v2”:“2.039”,“v3”:“2.039”,"%":"-35,7%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“3”,“nm”:“Araraquara Setor II”,“v1”:“749”,“v2”:“996”,“v3”:“996”,"%":"-24,8%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“4”,“nm”:“Matao Setor I”,“v1”:“121”,“v2”:“190”,“v3”:“190”,"%":"-36,32%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“5”,“nm”:“Jaboticabal Setor I”,“v1”:“5.463”,“v2”:“6.788”,“v3”:“6.788”,"%":"-19,52%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“6”,“nm”:“Guariba Setor I”,“v1”:“676”,“v2”:“746”,“v3”:“746”,"%":"-9,38%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“7”,“nm”:“Franca”,“v1”:“3.205”,“v2”:“3.936”,“v3”:“3.936”,"%":"-18,57%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“8”,“nm”:“So Carlos”,“v1”:“1.519”,“v2”:“1.814”,“v3”:“1.814”,"%":"-16,26%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“9”,“nm”:“Guariba Setor II”,“v1”:“659”,“v2”:“978”,“v3”:“978”,"%":"-32,62%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“10”,“nm”:“Ituverava”,“v1”:“1.963”,“v2”:“2.623”,“v3”:“2.623”,"%":"-25,16%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“11”,“nm”:“Jaboticabal Setor II”,“v1”:“1.636”,“v2”:“2.184”,“v3”:“2.184”,"%":"-25,09%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“12”,“nm”:“Matao Setor II”,“v1”:“100”,“v2”:“116”,“v3”:“116”,"%":"-13,79%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“13”,“nm”:“Leme”,“v1”:“5.609”,“v2”:“7.071”,“v3”:“7.071”,"%":"-20,68%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“14”,“nm”:“Araraquara Local”,“v1”:“1.313”,“v2”:“1.642”,“v3”:“1.642”,"%":"-20,04%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“15”,“nm”:“Ribeirao Preto Setor I”,“v1”:“201”,“v2”:“197”,“v3”:“197”,"%":“2,03%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“16”,“nm”:“Ribeirao Preto Setor II”,“v1”:“59”,“v2”:“38”,“v3”:“38”,"%":“55,26%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“17”,“nm”:“Ituverava II”,“v1”:“172”,“v2”:“233”,“v3”:“233”,"%":"-26,18%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“18”,“nm”:“Amrico Brasiliense”,“v1”:“2.814”,“v2”:“3.621”,“v3”:“3.621”,"%":"-22,29%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“19”,“nm”:“Tadeu”,“v1”:“416”,“v2”:“381”,“v3”:“381”,"%":“9,19%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“20”,“nm”:“Matao Setor IV”,“v1”:“13”,“v2”:“12”,“v3”:“12”,"%":“8,33%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“21”,“nm”:“Ricardo Araras”,“v1”:“140”,“v2”:“104”,“v3”:“104”,"%":“34,62%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“22”,“nm”:“Ribeirao Preto Local”,“v1”:“1.568”,“v2”:“1.958”,“v3”:“1.958”,"%":"-19,92%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“23”,“nm”:“Ribeirao Preto Local II”,“v1”:“3.854”,“v2”:“4.731”,“v3”:“4.731”,"%":"-18,54%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“25”,“nm”:“Batatais”,“v1”:“1.253”,“v2”:“1.608”,“v3”:“1.608”,"%":"-22,08%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“26”,“nm”:“Barretos”,“v1”:“4.532”,“v2”:“5.712”,“v3”:“5.712”,"%":"-20,66%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“27”,“nm”:“Porto Ferreira”,“v1”:“5.647”,“v2”:“5.850”,“v3”:“5.850”,"%":"-3,47%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“28”,“nm”:“Pontal”,“v1”:“159”,“v2”:“275”,“v3”:“275”,"%":"-42,18%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“29”,“nm”:“Marcos Rio Claro”,“v1”:“1.465”,“v2”:“706”,“v3”:“706”,"%":“107,51%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“30”,“nm”:“Bonfim Paulista”,“v1”:“139”,“v2”:“165”,“v3”:“165”,"%":"-15,76%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“31”,“nm”:“Taquaritinga”,“v1”:“911”,“v2”:“1.061”,“v3”:“1.061”,"%":"-14,14%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“32”,“nm”:“Ziza”,“v1”:“732”,“v2”:“511”,“v3”:“511”,"%":“43,25%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“33”,“nm”:“Carlinhos”,“v1”:“305”,“v2”:“217”,“v3”:“217”,"%":“40,55%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“34”,“nm”:“Antnio Carlos”,“v1”:“552”,“v2”:“481”,“v3”:“481”,"%":“14,76%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“35”,“nm”:“Marco Leme”,“v1”:“1.478”,“v2”:“601”,“v3”:“601”,"%":“145,92%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“36”,“nm”:“Adilson”,“v1”:“1.071”,“v2”:“0”,“v3”:“0”,"%":“inf,%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“37”,“nm”:“Ribeirao Preto Local III”,“v1”:“1.309”,“v2”:“995”,“v3”:“995”,"%":“31,56%”,“su”:“1”,“dt”:""},{“op”:“2”,“id”:“38”,“nm”:“Maria Helena”,“v1”:“51”,“v2”:“80”,“v3”:“80”,"%":"-36,25%",“su”:"-1",“dt”:""},{“op”:“2”,“id”:“39”,“nm”:“Ribeirao Preto Local IV”,“v1”:“124”,"v

Note the second “text” has 4093 character .

There are limite to receive information on tcpsocket ?
Thanks

TCP guarantees that packets are sent in order reliably
However, packets ? the “message” you sent
You may send one large message but get several data available events on the receiving end
You’ll have to reassemble the entire “message”

In addition to what Norman said, are you sure you aren’t getting an exception? and is this in 2015r1?

Yes I am using xojo 2015 r1 , the problem seems to be in memoryblock when I get the message of tcpsocket server .

In this code :
dim mBuffer As xojo.Core.MemoryBlock = me.ReadData(AvailableData.Size)

the mBuffer variable receive data truncate on the 4093 character .

Right
See what I wrote
Receiving “some data” is not the same as receiving “all the data sent”

what do i do ?
What is the best method to receive data on iOS ?
Thanks Norman

You need to not just send & receive “data” but actually design a “protocol” so you can tell when you have received all the data.
I suspect that’s the issue here.
You send out 4096 bytes but the receiving end has no way of knowing when it has all of what you sent.

Or receive it using a socket type that already implements a protocol that does this like HTTP

On iOS I’d start by using httpsocket

You mean then that TCP has limitation in sending the string, ie 4096 ? The HttpSocket will solve the problem seems the size of the message?

No, there’s no limit, but you just won’t get all of the data in a single DataAvailable event. You’ll receive multiple DataAvailable event with the data broken down into chunks.

Got it , it means that if I want to use tcpsocket teriar to send the broken packages , right?
Many Thanks

TCP is JUST a transport mechanism (a pipe so to speak)
You say “send this” and it sees to it that “it” gets sent
It may break it into multiple chunks to do so reliably
The DataAvailable event on the TCP Socket is “hey you got some stuff” - but not “hey that entire thing sent by the server has been received”

TCP implements NO protocol handling natively and so it just sends & receives bytes - but it does so reliably & in order.

For you to know if you have sent & received an entire “message” you need to design some mechanism to know what constitutes a “message”

HTTP does this - it has well defined “beginning” and “ending” of an http “message”
Any protocol that runs over TCP does this

So your server might need to send something that is recognizable as a “message”
This might include a “header” that says “the message is this big”, then send all the data and then an “end of message”
The receiver then needs to read all the data (bytes), see if it now has a complete “message” in its received data and when it does process that message

This is one reason I suggested trying HTTP and having your server respond to HTTP requests
The protocol handling is already done for you

Thanks Norman !!!, I will use HTTP.