I just started playing around with the Ethernet Shield W5100 for Arduino.I found an example for receiving TCP IP information. I am using VVVV TCP Client for sending data.

Question 1:I am not sure why or if this is needed, but it seems the example is setting a client = server.available().

Does this do anything or could server be used in the place of client everywhere in the example? I'm just not sure if changing to an EthernetClient variable from an EthernetServer type has some benefit.

Question 2:When I try to send data to the Arduino, it seems to take a long time to connect, and I am never sure when the connection has been made until the Serial.print starts showing.

Is there a way to know how long the connection should take or to verify that there is a connection before sending data that will be lost?

Question 3:When I send a message ( example <255,000,100> ) I have the char array set to size 11 so it can get the RGB information. When this information prints, I randomly receive an extra character at the end of the message. I don't think this is coming from VVVV and I am not sure how the message can have 12 characters when the array is set to only hold 11.

Seems the only way I can get the message to print correctly is by adding in a delay(); after printing. I don't understand how or why this would work... but it does. I hate these kinds of solutions, so I welcome any other suggestions. Although, it seems like I am just posting to myself here.

I haven't used my Ethernet shield in a while.I was going to try it again, but I had no problems a few months ago.I mostly tried the WebServer example.And I did not make the modifications described in the link.I was told I was just lucky. LOL.

@ieee488 - Thank you for pointing me to the other forum link. It didn't change my problem, but it may have helped with other functionality I am not using.

I am not very familiar with how to use the Streaming Class properly. It is working, but I just don't understand why flush() doesn't actually flush and data seems to be carried over from previous messages.

If I sent a message like ABCXYZ, then sent a message 1234, it would print 1234YZ...I can even reset the arduino and send 1234 and it will still print the remaining characters from previous messages.

PaulS

If I hand you a stick, when you expect a stick, you can handle that, right?

If I hand you a rattlesnake when you expect a stick, that's a bit harder to handle, right?

If you NULL-terminate your array, making it a string, you can then hand it to functions that expect a string, and get the expected behavior. You are handing a rattlesnake to a function that expects a stick, and acting surprised when the function does something unexpected.