It is funny because it is very hard to find anything information about stackoverflows on the arduino because of the similarly named website.
But here is my problem:
I have a function that reads the client data then proceeds to parse it. Initially I wrote my own multibyte read function but just changed to the built in one. Same problem occurs.
Upon leaving the function the arduino crashes and resets to the setup routine.
I think that it has to do with some garbage on the end of the incoming data. If I read less than the 22 incoming bytes then it does not crash until I attempt to read it again. The incoming bytes can change so I can ignore what are garbage now because it will be data later on(the data also has a variable length). All of the data is numeric ascii with spaces.
Any thoughts or solutions would be great.
I removed all of the parsing because it is commented out in my code.
int DecodeHeader(void)
{
//int iReturn = 0;
//const UN_FEP_HEADER *punHdr;int iIncomingBytes = 0;
byte byteHeaderBuffer[MAX_INPUT_PACKET_SIZE];
char acDataReport[MAX_INPUT_PACKET_SIZE];iIncomingBytes = client.read(byteHeaderBuffer, MAX_INPUT_PACKET_SIZE);
sprintf(acDataReport,"Byte Count: %d\nOutput String: %s",iIncomingBytes,byteHeaderBuffer);
Serial.println(acDataReport);return 0;
}