44#include < string.h>
55#include < thread>
66
7+ template <uint16_t BUFFER_SIZE = AS_DEFAULT_BUFFER_SIZE>
78class UDPSocket : public BaseSocket
89{
910public:
@@ -14,7 +15,6 @@ class UDPSocket : public BaseSocket
1415 {
1516 if (useConnect)
1617 {
17-
1818 std::thread t (Receive, this ); // usage with Connect()
1919 t.detach ();
2020 }
@@ -135,10 +135,10 @@ class UDPSocket : public BaseSocket
135135private:
136136 static void Receive (UDPSocket* udpSocket)
137137 {
138- char tempBuffer[UDPSocket:: BUFFER_SIZE];
138+ char tempBuffer[BUFFER_SIZE];
139139 ssize_t messageLength;
140140
141- while ((messageLength = recv (udpSocket->sock , tempBuffer, UDPSocket:: BUFFER_SIZE, 0 )) != -1 )
141+ while ((messageLength = recv (udpSocket->sock , tempBuffer, BUFFER_SIZE, 0 )) != -1 )
142142 {
143143 tempBuffer[messageLength] = ' \0 ' ;
144144 if (udpSocket->onMessageReceived )
@@ -154,10 +154,10 @@ class UDPSocket : public BaseSocket
154154 sockaddr_in hostAddr;
155155 socklen_t hostAddrSize = sizeof (hostAddr);
156156
157- char tempBuffer[UDPSocket:: BUFFER_SIZE];
157+ char tempBuffer[BUFFER_SIZE];
158158 ssize_t messageLength;
159159
160- while ((messageLength = recvfrom (udpSocket->sock , tempBuffer, UDPSocket:: BUFFER_SIZE, 0 , (sockaddr* )&hostAddr, &hostAddrSize)) != -1 )
160+ while ((messageLength = recvfrom (udpSocket->sock , tempBuffer, BUFFER_SIZE, 0 , (sockaddr* )&hostAddr, &hostAddrSize)) != -1 )
161161 {
162162 tempBuffer[messageLength] = ' \0 ' ;
163163 if (udpSocket->onMessageReceived )
0 commit comments