Hello!
I'm not sure if this is the right place to ask my question...
According to the docs, it is possible to receive udp datagrams asynchronous
using the Socket-class and its .BeginRecive(From) method. My problem is that
I can't figure out how big the receive-buffer should be.
When my programs fires the receive-callback function, I call the
EndReceive(From) method to copy the received datagrams to the buffer that
I've supplied earlier in the BeginReceive(From) method. It's a
Byte()-variable with a fixed size (32kb).
-->
m_Gateway.BeginReceiveFrom(m_Buffer, 0, m_Buffer.Length, SocketFlags.None,
m_remoteEP, AddressOf UDPCallback, Nothing)
<--
m_Buffer is initialized with a fixed size of 32kb.
Whenever my application receives a large amount of data (>32kb) my
receive-callback terminates with an exception "there was more data to
receive" (translated from german)... Of course, this error only occures when
my receive-buffer is too small:
-->
lRead = m_Gateway.EndReceiveFrom(iarg, m_remoteEP)
<--
Is there any possibility to "see" the size of the received data -before-
calling .EndReceive(From)? I've tried the .Available property but its value
is either "0" or much too small.
It can't be that I need to supply a hardcoded-sized Byte()-buffer, can it?