Output buffer size?
vining
Posts: 4,368
I was recently work on a module that needed to send a string to an IP device. It actually was sending out a web page and the HTML was just under 17k long.
At first I was having a problem with my variable that held the string to send being truncated at the 15999 cut off point so I used the ConcatString function that AMXJeff posted a while ago to build that string in the variable but the problem persisted although the variable was now holding the entire string the HTML was being delivered incomplete.
I can only assume that the buffer that holds the string also has a limit so I ended up having to do this:
At first I was having a problem with my variable that held the string to send being truncated at the 15999 cut off point so I used the ConcatString function that AMXJeff posted a while ago to build that string in the variable but the problem persisted although the variable was now holding the entire string the HTML was being delivered incomplete.
I can only assume that the buffer that holds the string also has a limit so I ended up having to do this:
if(LENGTH_STRING(cWebHead)) { WHILE(LENGTH_STRING(cWebHead) > MAX_MTU) { SEND_STRING dvWeb, "GET_BUFFER_STRING(cWebHead,MAX_MTU)" ; } if(LENGTH_STRING(cWebHead)) { SEND_STRING dvWeb, "cWebHead" ; } ///////////////////////////////////////////////// if(LENGTH_STRING(cWebMessage))//no body w/o head { WHILE(LENGTH_STRING(cWebMessage) > MAX_MTU) { SEND_STRING dvWeb, "GET_BUFFER_STRING(cWebMessage,MAX_MTU)" ; } if(LENGTH_STRING(cWebMessage)) { SEND_STRING dvWeb, "cWebMessage" ; } } }Is anyone aware of a limit of what the output buffer can hold? Does anyone know how the the master sends strings to TCP IP devices? I assume it sends them in max TCP MTU chunks and doesn't try to send the entire string at once. Anybody know? I guess if I set up another master to receive the HTML I could test this but that sounds like too much work.
0
Comments
The limitation is with SEND_COMMAND (approx. 200 characters) and SEND_STRING (approx 2K characters) when dealing with real devices.
Virtual devices have the 2K limit for both COMMAND and STRING.
If send string has a limit of 2K to a real device then why did my code that sent a string which cosisted of a 16.7k variable get cut short somewhere around the 16k point? I don't know for sure since I didn't measure the the source of the incomplete HTML. It was nearly complete though so something is going on.
The smaller HTMLs that were around 13K could be sent out in a single send_string and worked fine but the HTML around 17K would get truncated. As I mentioned I had already fixed the variable that held the string with the ConcatString function so that was no longer the issue and in debug it could be viewed in its entirety, all 17K. So me was thinking there was a buffer limit. I never even thought of a send string limit but in this case it definitely isn't a 2K limit. Maybe it's 15999?
There are two things at play here: SEND_STRING to sockets and max string expression size.
1) SEND_STRING to socket D:P:S values (ex. 0:5:0) are special in that the transmission of the string ties directly from the NetLinx Interpreter to the physical IP socket. So the data is not bound by some of the more restrictive limitations of master firmware for transmission to say NetLinx Touch Panels or serial based devices.
2) But what is a restriction is the maximum size for a single string expression. (ex. "'This is string number ',ITOA(i)") The maximum string expression allowed is 16000 8-bit CHAR.
Have you tried simply removing the double quotes from around your array in the call to SEND_STRING? This will send the array variable directly rather than first running it through the string expression processor.
Not really but I suppose I could run the completed variable array through the ConcantString function again or just do a simpler string_to_variable - variable_to_string function since this STV function must run through the string expression processor prior to the conversion. This would essentially remove my double quotes, wouldn't it?
Based on your code sample I assume the data to transmit is in either cWebHead or cWebMessage. So all you need to do is:
SEND_STRING dvWeb,cWebHead
or
SEND_STRING dvWeb,cWebMessage
Aftere a little more thought I guess the VTS & STV function wouldn't make a difference since the string expresions have to run through the string expression processor every time you add one to the variable.
In the code posted previously both are sent out, 1st section being the HTTP response and 2nd being the HTTP content. In the example I posted I just started sending it out in max MTU chucks since the complete content wouldn't otherwise arrive at the client.
Basically I had what you just posted but since that didn't work I decided to send it out in 1500 byte chunks as posted.