Can't call Client.connect() inside class

I'm trying to create a class that acts as a wrapper for managing various types of internet connections (Ethernet, WiFi, Cellular).

I got Cellular working, which was the hardest by far. But getting Ethernet is proving difficult as well. (The default Ethernet library uses blocking code which is horrible for my application)

Whenever I try to call connect(ip,port) inside my class, I get a compile-time error that says "invalid use of non-static member function".

I'd imagine it has to do with trying pass in data that can be deleted or otherwise non-static into a function that requires it to stick around. As much coding as I do in C++, I don't actually run into this issue terribly often, so I'm prepared for face-palms.

For reference, here is the class:

class CESEthernet : public CESCommSlot
{
public:
	CESEthernet();
	~CESEthernet();

	void taskHandler();
	bool isReady();
	bool isOnNetwork();
	bool sendPayload(String payload);

private:
	EthState itsState;
	EthernetClient itsClient;
	

	void a_PowerUp();
	void a_DHCP();
	void a_Connect();
	void a_Maintain();

	void i_Disconnect();
	void i_Poweroff();

	StopWatch GP_Timer = StopWatch(false);
	uint8_t GP_Counter;

	byte mac[6];

};

And here is the method:

void CESEthernet::a_Connect()
{
	if (GP_Timer.start(itsNetConfig.RemoteTimeout)) //Initializes to RemoteTimeout when the timer initially starts
	{
		DebugMessage(DM_INFO, F("Web Connect"));
	}
	
	if (GP_Timer.passed(itsNetConfig.RemoteTimeout))
	{
		if (itsClient.connect(itsNetConfig.IPAddr.toCharArray, itsNetConfig.rPort))
		{
			//Success
			DebugMessage(DM_INFO, F("Connected To ") + itsNetConfig.IPAddr + ":" + String(itsNetConfig.rPort));
			itsState = ETH_DHCP;
			GP_Timer.stop();
		}
		else
		{
			//Failure
			DebugMessage(DM_ERROR, F("Connection Failed"));
			GP_Timer.reset();
		}
	}
}

google!

::

Mark

Well yeah. I generally don't post something onto a forum unless I'm having trouble finding relevant information on google.

Can you post an MCVE?

OK so in the process, I found the issue.

I replaced "itsClient.connect(itsNetConfig.IPAddr.toCharArray" with a string literal. In this case, "Google.com".

guess I'll just have to figure out how to pass the desired website as a char array using some other method.

what you googled "C++ call static member" or somthing like that! I don't think you did. By the way if you look at my initial reply I gave you the answer.

In other words I told you

A. how to find the answer and

B. What the answer was ::

Mark