The number in PrintObjectTobuffer is the MAX size that it is allowed to use.
So we start with:
char packJSON[1000];
you then do memset..
memset(packJSON,'\n',sizeof(packJSON));
you fill the 1000 bytes with \n....
what will strlen(packJSON) return?
strlen starts at the beginning of packJSON and ...
Search found 445 matches
- Thu Mar 25, 2021 1:36 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
- Wed Mar 24, 2021 7:51 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
Re: Json Lexer - ParsedJsonDataSet
I have to admit I am at a loss why this works, but it does.
JsonOutObject.PrintObjectToBuffer(packJSON, sizeof(packJSON));
fdprintf(ws_fd, "%s",packJSON);
Yet this does not.
JsonOutObject.PrintObjectToBuffer(packJSON, strlen(packJSON));
fdprintf(ws_fd, "%s\n\n",packJSON);
Thank you for all ...
JsonOutObject.PrintObjectToBuffer(packJSON, sizeof(packJSON));
fdprintf(ws_fd, "%s",packJSON);
Yet this does not.
JsonOutObject.PrintObjectToBuffer(packJSON, strlen(packJSON));
fdprintf(ws_fd, "%s\n\n",packJSON);
Thank you for all ...
- Wed Mar 24, 2021 7:28 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
Re: Json Lexer - ParsedJsonDataSet
FWIW, I just tested this.
JsonOutObject.PrintObjectToBuffer(packJSON, sizeof(packJSON));
printf("Size[%u][%u]\r\n", strlen(packJSON), sizeof(packJSON) );
This is what it printed, am i missing something ? aren't I packing more using sizeof?
Size[412][1000]
JsonOutObject.PrintObjectToBuffer(packJSON, sizeof(packJSON));
printf("Size[%u][%u]\r\n", strlen(packJSON), sizeof(packJSON) );
This is what it printed, am i missing something ? aren't I packing more using sizeof?
Size[412][1000]
- Wed Mar 24, 2021 7:23 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
Re: Json Lexer - ParsedJsonDataSet
JsonOutObject.PrintObjectToBuffer(packJSON, strlen(packJSON)); <-----Potential problem
JsonOutObject.PrintObjectToBuffer(packJSON, sizeof(packJSON));
writestring(ws_fd, packJSON);
Curious, after JsonOutObject.DoneBuilding(); Wouldent sizeof pack the whole size of packJSON?
Shouldn't I really ...
- Wed Mar 24, 2021 6:23 pm
- Forum: NetBurner Software
- Topic: Json Lexer - Parse Receive data
- Replies: 5
- Views: 7510
Re: Json Lexer - Parse Receive data
I got it the Json parsing now, thank you for your help Paul!
- Wed Mar 24, 2021 6:18 pm
- Forum: NetBurner Software
- Topic: Json Lexer - Parse Receive data
- Replies: 5
- Views: 7510
Re: Json Lexer - Parse Receive data
I seem to be getting close to your answers, thank you. I finally took a look at the example
C:\nburn\examples\StandardStack\WebClient\EarthQuake.
char rx_buffer[ETHER_BUFFER_SIZE + 1];
C:\nburn\examples\StandardStack\WebClient\EarthQuake.
char rx_buffer[ETHER_BUFFER_SIZE + 1];
- Wed Mar 24, 2021 6:13 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
Re: Json Lexer - ParsedJsonDataSet
I did try that yesterday,
JsonOutObject.PrintObjectToFd( ws_fd);
write(ws_fd,"\n\n",2);
But since its not all send as one string it did not work.
I wound up doing this and it worked.
memset(packJSON,'\n',sizeof(packJSON));
JsonOutObject.PrintObjectToBuffer(packJSON, strlen(packJSON ...
JsonOutObject.PrintObjectToFd( ws_fd);
write(ws_fd,"\n\n",2);
But since its not all send as one string it did not work.
I wound up doing this and it worked.
memset(packJSON,'\n',sizeof(packJSON));
JsonOutObject.PrintObjectToBuffer(packJSON, strlen(packJSON ...
- Wed Mar 24, 2021 5:47 pm
- Forum: NetBurner Software
- Topic: Json Lexer - Parse Receive data
- Replies: 5
- Views: 7510
Re: Json Lexer - Parse Receive data
Thank you for the help! Tried a few ways but keep getting Trap errors.
This is what I have thus far.
if (FD_ISSET(ws_fd, &read_fds))
{
int len = read( ws_fd, rx_buffer, ETHER_BUFFER_SIZE );
printf("RX[%d]:%s\r\n",len,rx_buffer);
ParsedJsonDataSet pjs(rx_buffer,len);
iprintf("%s\r\n",pjs ...
This is what I have thus far.
if (FD_ISSET(ws_fd, &read_fds))
{
int len = read( ws_fd, rx_buffer, ETHER_BUFFER_SIZE );
printf("RX[%d]:%s\r\n",len,rx_buffer);
ParsedJsonDataSet pjs(rx_buffer,len);
iprintf("%s\r\n",pjs ...
- Wed Mar 24, 2021 5:19 pm
- Forum: NetBurner Software
- Topic: Json Lexer - ParsedJsonDataSet
- Replies: 11
- Views: 14162
Re: Json Lexer - ParsedJsonDataSet
But that wont put it into the JsonOutObject.just printf a \n\n?
- Tue Mar 23, 2021 8:19 pm
- Forum: NetBurner Software
- Topic: Json Lexer - Parse Receive data
- Replies: 5
- Views: 7510
Json Lexer - Parse Receive data
Looking at the examples Json, I am still confused...
I am using websockets on port 22000. When the browser sends me a json formatted string I get the data just fine.
Now I would like to parse and pull that data out. How do i put my received data into a JsonInObject so i can then use JsonInObject ...
I am using websockets on port 22000. When the browser sends me a json formatted string I get the data just fine.
Now I would like to parse and pull that data out. How do i put my received data into a JsonInObject so i can then use JsonInObject ...