Simplify using of UnbufferedSerial(Serial), USBCDC, TCP, SMTP, NTP Fork : https://github.com/YSI-LPS/lib_Transmission
Dependents: lib_Transmission_Serial_example 2022_TICE_Electrolyse lib_Transmission_TCP_example
Diff: lib_Transmission.cpp
- Revision:
- 26:fe26375f733e
- Parent:
- 25:01db56f04262
- Child:
- 27:87c2a2a23d06
diff -r 01db56f04262 -r fe26375f733e lib_Transmission.cpp --- a/lib_Transmission.cpp Tue Jul 06 13:12:27 2021 +0000 +++ b/lib_Transmission.cpp Fri Jul 23 08:14:09 2021 +0000 @@ -373,10 +373,10 @@ { for(const string& ssend : smtpParams[(sFROM.empty())?1:0]) { - char buffer[256] = {0}; + char buffer[64] = {0}; if(code.empty()) { if(eth_error("clientSMTP_connect", clientSMTP.connect(SocketAddress(server, 25))) < NSAPI_ERROR_OK) break; } else if(eth_error("clientSMTP_send", clientSMTP.send(ssend.c_str(), ssend.size())) < NSAPI_ERROR_OK) break; - if(eth_error("clientSMTP_recv", clientSMTP.recv(buffer, 256)) < NSAPI_ERROR_OK) break; + if(eth_error("clientSMTP_recv", clientSMTP.recv(buffer, 64)) < NSAPI_ERROR_OK) break; buffer[3] = 0; code += buffer; if(ssend == "QUIT\r\n") break; @@ -395,7 +395,7 @@ time_t Transmission::ntp(const char* server) { if(!_eth) return 0; - if((!message.DHCP) || (_eth->get_connection_status() != NSAPI_STATUS_GLOBAL_UP)) return 0; + if((!message.DHCP) || (_eth->get_connection_status() != NSAPI_STATUS_GLOBAL_UP)) return time(NULL); time_t timeStamp = 0; UDPSocket clientNTP; clientNTP.set_timeout(2000);