Turns out it wasn't as bad as I thought.
WifiClient and EthernetClient are very similarly written.
Thus changing the words "WiFi" to "Ethernet" and deleting a few instances of "timeout" since it isn't used in a few of the Ethernet functions.
The full code is on pastebin here: Laggger164's Pastebin - Pastebin.com
Unfortunately there seems to be a problem when trying to write a new file, every function then hangs up on FTP error: Offline and I am not sure why.
It does read the content fine though.
My suspicion is that this function has something to do with it. I tried deleting the "timeout" variable from it but nothing changed, just failed faster.
void ESP32_FTPClient::GetFTPAnswer (char* result, int offsetStart) {
char thisByte;
outCount = 0;
unsigned long _m = millis();
while (!client.available() && millis() < _m + timeout) delay(1);
if( !client.available()){
memset( outBuf, 0, sizeof(outBuf) );
strcpy( outBuf, "Offline");
_isConnected = false;
isConnected();
return;
}
Definitely a step in the right direction, just have to figure out why it doesn't want to write the file.
Then I can try using this to get the picture across.
Finally I will be making a communication system that would take both pictures, send a pic from one ESP32CAM to the other, connected to which is the W5500 ethernet module and then send both pictures to a server.
This will start as a simple button command, however I will make a remote command somehow.
Here is the output from serial monitor:
16:40:23.332 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
16:40:23.332 -> configsip: 0, SPIWP:0xee
16:40:23.332 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
16:40:23.332 -> mode:DIO, clock div:1
16:40:23.332 -> load:0x3fff0018,len:4
16:40:23.332 -> load:0x3fff001c,len:1216
16:40:23.332 -> ho 0 tail 12 room 4
16:40:23.332 -> load:0x40078000,len:10944
16:40:23.332 -> load:0x40080400,len:6388
16:40:23.332 -> entry 0x400806b4
16:40:24.325 -> Initialize Ethernet with DHCP:
16:40:29.282 -> My IP address: 192.168.55.117
16:40:29.282 -> Connecting to: 192.168.55.200
16:40:29.282 -> Command connected
16:40:29.282 -> Send USER
16:40:29.282 -> Send PASSWORD
16:40:29.282 -> Send SYST
16:40:29.282 -> Send TYPE
16:40:29.282 -> Type A
16:40:29.282 -> Send PASV
16:40:29.282 -> Data port: 37862
16:40:29.282 -> Data connection established
16:40:29.282 -> Send CWD
16:40:29.282 -> Send MLSD
16:40:29.282 -> Result start
16:40:29.282 -> Result: 150 Opening ASCII mode data connection for MLSD
16:40:29.282 -> Result end
16:40:29.282 ->
16:40:29.282 -> Directory info:
16:40:29.282 -> modify=20210707143317;perm=flcdmpe;type=cdir;unique=D249C87BUC;UNIX.group=0;UNIX.groupname=media;UNIX.mode=0755;UNIX.owner=1000;UNIX.ownername=josai; .
16:40:29.282 -> modify=20210707143147;perm=flcdmpe;type=pdir;unique=D249C87BU9;UNIX.group=0;UNIX.groupname=media;UNIX.mode=0755;UNIX.owner=1000;UNIX.ownername=josai; ..
16:40:29.282 -> modify=20210707143322;perm=adfrw;size=3;type=file;unique=D249C87BUF;UNIX.group=0;UNIX.groupname=media;UNIX.mode=0744;UNIX.owner=1000;UNIX.ownername=josai; pootis.txt
16:40:29.282 -> Send TYPE
16:40:29.282 -> Type A
16:40:34.256 -> FTP error: Offline
16:40:34.291 -> Send PASV
16:40:39.294 -> FTP error: Offline
16:40:39.294 -> Bad PASV Answer
16:40:39.703 -> Connection closed
16:40:39.703 -> Send MKD
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Send CWD
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Send TYPE
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Send STOR
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Writing
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Close File
16:40:39.703 -> Send TYPE
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Send STOR
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Write File
16:40:39.703 -> FTP error: Offline
16:40:39.703 -> Close File
16:40:39.703 -> Connection closed