Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

SerialPort BytesToRead only ever returns 256

SerialPort

Best Answer Riaan Mastenbroek, 27 May 2015 - 09:32 PM

Okay!!

 

After 4 days I figured that one has to send multiple AT+HTTPREAD requests to get the entire buffer.

 

The first HTTPREAD returns the full buffer length and then one has to loop to get the rest using AT+HTTPREAD=" + pos + "," + count; where pos is the last query and count typically 256 up until you read the entire buffers lenght each time adjusting the pos by +count.

 

Phew...this one had me running around! Getting there....

 

Riaan

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 Riaan Mastenbroek

Riaan Mastenbroek

    Member

  • Members
  • PipPip
  • 19 posts

Posted 25 May 2015 - 07:25 PM

Hi,

 

For some reason my serialport only ever returns no more than 256 bytes if I run this code after I did a write:

 

while (_modemConnection.BytesToRead > 0)
                {
                    response += (char)_modemConnection.ReadByte();
                }
 
                return response;
 
How can I get the next 256 and so on...I know there is way more to come and I can see only a part of the expected string.
 
Riaan


#2 Riaan Mastenbroek

Riaan Mastenbroek

    Member

  • Members
  • PipPip
  • 19 posts

Posted 25 May 2015 - 08:38 PM

Hi,

 

Please just take note of this post for future reference. It seems like the Sim900 module of the GPRS Shield can only return up to 256 bytes. When you request to read all messages it will only return up to 256 bytes...so you have to delete the messages read and get the next lot. And...the last message are usually incomplete.

 

The GPRS module returns correctly.



#3 Riaan Mastenbroek

Riaan Mastenbroek

    Member

  • Members
  • PipPip
  • 19 posts

Posted 27 May 2015 - 07:24 PM

Hi,

 

I am re-opening this post out of pure desperation. I am only getting back 256 bytes from either the GPRS or the SMS and cannot for the life of me get more bytes to stream. My data stream is incomplete and no matter what I try I only get back 256 bytes.

 

Any suggestions please??

 

I have tried the DataReceived event and I have done a ReadBytes...but both only give back NO MORE than 256.

 

Riaan



#4 Riaan Mastenbroek

Riaan Mastenbroek

    Member

  • Members
  • PipPip
  • 19 posts

Posted 27 May 2015 - 09:32 PM   Best Answer

Okay!!

 

After 4 days I figured that one has to send multiple AT+HTTPREAD requests to get the entire buffer.

 

The first HTTPREAD returns the full buffer length and then one has to loop to get the rest using AT+HTTPREAD=" + pos + "," + count; where pos is the last query and count typically 256 up until you read the entire buffers lenght each time adjusting the pos by +count.

 

Phew...this one had me running around! Getting there....

 

Riaan







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.