Why I am I getting this irritating compile error?

Stream.h:note candidate expects 0 arguments, 1 provided
EspDrv.cpp:670:39: error: no matching function for call to 'Stream::peek(uint16_t)
:strBuff[7] = espSerial->peek(nI + 1)

Do I need to delete some obj files some where to force the arduino core to be rebuilt?

If so where are they located?

I have added some new peek(…) functions to class Stream…as pure virtual functions

lass Stream : public Print
{
  protected:
    unsigned long _timeout;      // number of milliseconds to wait for the next char before aborting timed read
    unsigned long _startMillis;  // used for timeout measurement
    int timedRead();    // private method to read stream with timeout
    int timedPeek();    // private method to peek stream with timeout
    int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout

  public:
    virtual int available() = 0;
    virtual int read() = 0;
    virtual int peek() = 0;
	virtual int peek(const uint16_t nI) = 0;
	virtual int peek(const uint8_t nI) = 0;

I have overridden and implemented these in class HardwareSerial:

class HardwareSerial : public Stream
{
  protected:
    volatile uint8_t * const _ubrrh;
    volatile uint8_t * const _ubrrl;
    volatile uint8_t * const _ucsra;
    volatile uint8_t * const _ucsrb;
    volatile uint8_t * const _ucsrc;
    volatile uint8_t * const _udr;
    // Has any byte been written to the UART since begin()
    bool _written;

    volatile rx_buffer_index_t _rx_buffer_head;
    volatile rx_buffer_index_t _rx_buffer_tail;
    volatile tx_buffer_index_t _tx_buffer_head;
    volatile tx_buffer_index_t _tx_buffer_tail;

    // Don't put any members after these buffers, since only the first
    // 32 bytes of this struct can be accessed quickly using the ldd
    // instruction.
    unsigned char _rx_buffer[SERIAL_RX_BUFFER_SIZE];
    unsigned char _tx_buffer[SERIAL_TX_BUFFER_SIZE];

  public:
    inline HardwareSerial(
      volatile uint8_t *ubrrh, volatile uint8_t *ubrrl,
      volatile uint8_t *ucsra, volatile uint8_t *ucsrb,
      volatile uint8_t *ucsrc, volatile uint8_t *udr);
    void begin(unsigned long baud) { begin(baud, SERIAL_8N1); }
    void begin(unsigned long, uint8_t);
    void end();
    virtual int available(void);
	virtual int peek(const uint16_t nI);
	virtual int peek(const uint8_t nI);
.
.
.
}

int HardwareSerial::peek(const uint16_t nI)
{
	int nResult = 0;
	
	if ((nI >= 0) && (nI < SERIAL_RX_BUFFER_SIZE))
		nResult = _rx_buffer[nI];
	
	return nResult;
}

int HardwareSerial::peek(const uint8_t nI)
{
	int nResult = 0;
	
	if ((nI >= 0) && (nI < SERIAL_RX_BUFFER_SIZE))
		nResult = _rx_buffer[nI];
	
	return nResult;
}

And I am trying to call those functions in EspDrv.cpp.
espSerial is defines as “static Stream *espSerial;”

bool EspDrv::isHttpReq()
{
	bool bResult = false;
	uint16_t nI = 0, nBytes = espSerial->available();
	char cCh = 0, strBuff[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
	
	// HTTP/1.1
	for (nI = 0; nI < nBytes; nI++)
	{
		cCh = espSerial->peek(nI);
		if (cCh == 'H')
		{
			strBuff[0] = cCh;
			strBuff[1] = espSerial->peek(nI + 1);
			strBuff[2] = espSerial->peek(nI + 1);
			strBuff[3] = espSerial->peek(nI + 1);
			strBuff[4] = espSerial->peek(nI + 1);
			strBuff[5] = espSerial->peek(nI + 1);
			strBuff[6] = espSerial->peek(nI + 1);
			strBuff[7] = espSerial->peek(nI + 1);
			bResult = strcmp_P(strBuff, (PGM_P)F("HTTP/1.1")) == 0;
			if (bResult)
			{
				Serial.print(F("**********"));
				Serial.print(strBuff);
				Serial.println(F("**********"));
			}
		}
	}
	return bResult;
}

Have you updated the AVR core?

If you have, the code in the install directory isn’t used, it is located (in windows) under your profile “AppData\Local\Arduino15”. If you enable verbose mode you can see which files it is using to compile.

However, modification of the core is not needed. As the data members your addition uses are protected, you can simply create a class which derives HardwareSerial. Then you can add your functions in that.This will mean you can upgrade the IDE/Core with out any issues.

Never mind - I am modifying the wrong copy of the core files. This multiple copies of the core business is an annoying problem I have to say. Why does there have to be multiple copies in multiple folders anyway?

pYro_65: Have you updated the AVR core?

If you have, the code in the install directory isn't used, it is located (in windows) under your profile "AppData\Local\Arduino15". If you enable verbose mode you can see which files it is using to compile.

However, modification of the core is not needed. As the data members your addition uses are protected, you can simply create a class which derives HardwareSerial. Then you can add your functions in that.This will mean you can upgrade the IDE/Core with out any issues.

I assume EspDrv.cpp/.h is using Stream* because people might want to use the WifiEsp library with a SoftwareSerial rather than hardware serial.

I can't add pure virtual functions to Stream because then it mucks the WifiEsp library up with objects with unimplemented pure virtual functions.

But I can just add some virtual functions implemented as {return 0;}

If you are writing code for other people to use, modifying the core is not a good way to implement it.

pYro_65: If you are writing code for other people to use, modifying the core is not a good way to implement it.

Just experimenting at this stage. It didn't work anyway - it totally mucked up the WifiEsp library so I have removed the changes I made to the core.

I am out of ideas, at this point, on how to figure out (inside the WifiEsp library) what the destination port a TCP client made the request to.

I know what the remote port and IP address are but they don't seem to be any help.

Without knowing what the destination port on the client, there is no way of knowing whether the WifiEsp server with port 80 should service the request or not.