khoih-prog / Ethernet_Generic

Simple Ethernet library for AVR, AVR Dx, Portenta_H7, Teensy, SAM DUE, SAMD21, SAMD51, STM32F/L/H/G/WB/MP1, nRF52 and RASPBERRY_PI_PICO boards using Ethernet shields W5100, W5200, W5500, W5100S, W6100. With this library you can use the Arduino Ethernet (shield or board) to connect to Internet to provides both Client and server functionalities.
42 stars 22 forks source link

'ETHERNET_SERVER_SEND_MAX_SIZE' was not declared in this scope #16

Closed vaelen closed 1 year ago

vaelen commented 1 year ago

Error:

Ethernet_Generic/src/EthernetServer_Impl.h:364:81: error: 'ETHERNET_SERVER_SEND_MAX_SIZE' was not declared in this scope

If you don't enable large buffer support, then the ETHERNET_SERVER_SEND_MAX_SIZE constant is not defiend and the code doesn't compile.

EthernetServer_Impl.h:327:

// Don't use larger size or hang, max is 16K for 1 socket
#ifdef ETHERNET_LARGE_BUFFERS
  #if MAX_SOCK_NUM <= 1
    #define ETHERNET_SERVER_SEND_MAX_SIZE         16384
  #elif MAX_SOCK_NUM <= 2
    #define ETHERNET_SERVER_SEND_MAX_SIZE         8192
  #elif MAX_SOCK_NUM <= 4
    #define ETHERNET_SERVER_SEND_MAX_SIZE         4096
  #else
    #define ETHERNET_SERVER_SEND_MAX_SIZE         2048
  #endif
#endif

EthernetServer_Impl.h:364

   written =  Ethernet.socketSend(sockindex, buf, min(bytesRemaining, (size_t) ETHERNET_SERVER_SEND_MAX_SIZE) );

I didn't submit a PR because I'm not sure what the constant should be set to if large buffers is disabled.

khoih-prog commented 1 year ago

Hi @vaelen

The new Ethernet_Generic v2.7.1 has just been published. Your contribution is noted in Contributions and Thanks.

Please have more rigorous tests to see if there still are some more bugs.

Best Regards,


Releases v2.7.1

  1. Auto-detect W5x00 and settings (ETHERNET_LARGE_BUFFERS, MAX_SOCK_NUM) to set MAX_SIZE to send. Check 'ETHERNET_SERVER_SEND_MAX_SIZE' was not declared in this scope #16
vaelen commented 1 year ago

Thanks! It is working well for me now.