Help with WiFi Library functions

Hello

I recently purchased a Arduino WiFi shield. I connetced the shield to Arduio Mega 2560. I wrote a small TCP/IP client sketch to connect to a PC server. Everything works fine as long as I send less than 92 bytes with each println() or print() or write() function call.

The following code

count = client.println (“12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012”);

Serial.print("Wrote bytes = ");

Serial.println(count);

The Serial.println() indicates only 2 bytes were written. I confirmed that Server only received 2 bytes by checking with wireshark.

  1. Is there a MAXIMUM Buffer size for TCP DATA?

  2. What else could be causing this behaviour?

If I create a String object and use the string object as the input parameter to println(), then I can send more then 92 byes. But if I define a char dataStr and fill it up with data that is more then 92 bytes, it does not work.

For example

const char dataStr = “41 00 BE 1F A8 13 >41 0C 0D 12 >41 0D 00 >41 11 2A >41 04 4F >41 05 6A >41 0F 4B >41 46 3A >41 10 01 49 >41 43 00 29 >NO DATA >NO DATA >41 33 64 >41 0E 93 >NO DATA >41 1F 00 27 >41 31 10 BB >”;

client.println(dataStr); // this only sends 2 bytes “\r\n”

If I declare

String dataStr = “41 00 BE 1F A8 13 >41 0C 0D 12 >41 0D 00 >41 11 2A >41 04 4F >41 05 6A >41 0F 4B >41 46 3A >41 10 01 49 >41 43 00 29 >NO DATA >NO DATA >41 33 64 >41 0E 93 >NO DATA >41 1F 00 27 >41 31 10 BB >\0”;

client.println(dataStr);

Then it sends the entire String object contenet. However the Server receives it in 3 Ethernet frames instead of one frame.

What is the difference in using String object and char for sending with WiFiClient println() function?

hmmmm…

Im no guru on this, but Im naturally uncanny when it comes to random luck at troubleshooting unfamiliar stuff…

My gut feeling is to try altering flow rates (baud)…slower…maybe even faster, but definitely slower…

I know the Pbasic code on early parallax stamp MCs acted similar to this and slowing it all down a bit was a correction on many scenarios.

Thank you. I will look into how to change the SPI communication speed. I have been looking at the code, it almost seems like there is some type of timing issue between the Mega 2560 and the AVr32 processor on the wifi shield.

Thanks

Shankar