Hi @ferdinand,
Thank you for the detailed explanation. I will try to implement the UDP server using the basic SOCKET from winsock library.
While digging into the SDK, I found that the AioServiceRef do have a function called RegisterReader, but I could not manage to successfully use it and there is no example code that I can learn from.
SO I wonder:
- Is it a good way to using RegisterReader function combined with the customized low level SOCKET? So that I can bypass the limitation of 1024 bytes?
- If so, can you please provide some example code of how to use the RegisterReader ? Suppose that I have the following code:
// I am not sure if I should create a new Reader Class to override the NotifyForRead function
class AioReaderRefNew : public maxon::AioReaderRef
{
public:
AioReaderRefNew() = default;
maxon::Result<void> NotifyForRead(maxon::SocketT socket, maxon::Result<void> result) {
iferr_scope;
DiagnosticOutput("NotifyForRead");
return maxon::OK;
}
};
AioReaderRefNew udpServerReader;
mSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
g_ioService = maxon::AioServiceRef::Create() iferr_return;
if (g_ioService.RegisterReader(mSocket, udpServerReader) == maxon::OK);
g_ioService.Start() iferr_return;
Apparaently the above did not successfully start the aioservice, so may be you could fix it?
Thank you