Compare commits

...

2 Commits

Author SHA1 Message Date
anschrammh
f0398b717b Added lastIndexOf helper function 2019-10-14 23:01:27 +02:00
anschrammh
ef0ab58add Minor bug correction 2019-10-14 22:59:31 +02:00
3 changed files with 23 additions and 6 deletions

View File

@ -6,7 +6,7 @@
#include "TCPClient.h"
#define MAX_CLIENT -1
//#define DEBUG_TCPS
#define DEBUG_TCPS
template <typename T>
@ -137,12 +137,9 @@ class TCPServer
#endif
_currentClient->_clientState = TCPClient::DISCARDED;
}
if(_currentClient->_dataSize > 0)
{
_currentClient->_newDataAvailable = false;
}
processClientData(_currentClient);//We process the actual data
_currentClient->_newDataAvailable = false;
if(_currentClient->_clientState == TCPClient::ClientState::DISCARDED)
{

View File

@ -49,3 +49,21 @@ char *dateTimeFormater(char *pointer, const uint8_t value, const char character)
return pointer;
}
char *lastIndexOf(char *str, const char character)
{
char *last(NULL), *current(str);
do
{
current = strchr(current, character);
if(current != NULL)
{
last = current;
if(*(current+1) == '\0')break;
current += 1;
}
}while(current != NULL);
return last;
}

View File

@ -55,6 +55,8 @@ typedef struct viewLink{
char *addChar(char *pointer, const char character);
char *lastIndexOf(char *str, const char character);
char *dateTimeFormater(char *pointer, const uint8_t value, const char character);
#endif //DEFINITION_H