Lvalue required as unary '&' operand

error: lvalue required as unary '&' operand
if (*(&wifiClient.peek()^ + incomingDataTransferSize) == EOT)

(I put in the ^ where it was on the error code.)
(EOT is defined as 0x0D earlier.)

I want to see if the last byte in the TCP/IP buffer equals EOT. Since the system won't let me do that using Client.read() or Client.peek(), I'll do it directly in memory.

Sorry,
Arduino Uno Wifi rev 2
Arduino IDE 2.2.1
WifiNINA.h
Mac OS

The peek() function returns an int by value. It's an rvalue (i.e. it's temporary). You can't take the address of an rvalue.

Have you got any ideas how to get the address of the first byte of the TCP/IP stack?

Read the data into your own buffer.

The idea is to avoid doing anything with the data until the transmission is complete. I don't want to waste processing time waiting for all of a transmission to come in.

Then don't. Have the code do something useful while waiting, checking periodically for more data. Only when the data transfer has completed and been buffered do you need to process it.

No. peek() only returns the the next byte, not the last.

That's what I'd like to do. How do I read only the last byte in the buffer?

Read and store the whole thing. The last byte will be then one at the end once the entire packet is received.

It would be nice to pop the buffer stack into something useful, push the last byte back onto the stack, then check what the last byte was, but that's beginning to look like wishful thinking.

Easier? Maybe. Faster? No.
Using an intermediate buffer also uses more memory.

I was going to look for the EOT while it was still on the stack.

I'm going to go back to an intermediate buffer.

Thanks Everybody!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.