Software Serial question (flushing software Serial)

Hello, i have a web server running on the arduino with wishield v2.0. I also have another arduino controlling the power strip sockets. So what happens when over the URL i type http://192.168.1.103/?PIN0 that sends a turn on or turn off depending on the current state over software serial to the other arduino. This part works fine. Where the issue comes is when I ask for current from the other arduino, basically I have a current sensor monitoring the sockets and when I initiate command currentRead it returns current for all of the sockets, when it returns it it sends it over serial to my arduino that is hosting the web server. When it does that it creates a buffer of information and the data that I am printing on the website is outdated. How would I flush the data after lets say 4 values have been received and ignore the other stuff. And where would i do that on the sending arduino or receiving arduino

How would I flush the data after lets say 4 values have been received

I'm almost certain it would be better to ask for one value at a time.

and ignore the other stuff.

Just set up a loop to read any not-yet-read data, and discard it.

And where would i do that on the sending arduino or receiving arduino

Seriously? Is there any unread data on the sender?

Flush normally applies to the outgoing side, not the incoming and means something like "write all data in the buffer to the output NOW". In the case of Serial (the UART type) it now means "wait until all data in the buffer has been written". SoftSerial does not support (according to the reference page) flush().

Mark

Flush normally applies to the outgoing side, not the incoming and means something like "write all data in the buffer to the output NOW".

Not until 1.0. Up until that version, flush() meant "throw away any unread serial data". Kind of like a toilet being flushed.

Neither the pre 1.0 or post 1.0 meanings of flush() are obvious. And re-purposing the name was just plain stupid.