I am having problems with UdpClient in C #. I transmit audio over the Internet between two clients.
On my microphone with a sampling frequency of 16 kHz, I send UDP packets with sound from 6400 bytes per packet. They never pass, with the exception of the last package, which is usually around 1200-3400, since I am closing the record. When I lower the sampling rate to 8 kHz, I send packets with a payload of 3200 bytes. For some reason they always pass.
So, basically something above 3200 becomes unsuccessful (the exact number has not been verified, but ...), why is this so? I thought maybe the internal UdpClient buffer is too small or something else? Since I transmit audio packets are often sent.
RECEIVE:
private void audioReceive(IAsyncResult asyn)
{
try
{
byte[] temp = audioSock.EndReceive(asyn, ref this.serverEP);
this.waveProvider.AddSamples(temp, 0, temp.Length);
this.textbox_display.Text = this.textbox_display.Text + " got bytes: " + temp.Length;
audioSock.BeginReceive(new AsyncCallback(audioReceive), null);
}
catch (Exception ez)
{
MessageBox.Show("audioReceive: " + this.textbox_nick.Text + " " +ez.ToString());
}
}
. ( asyn null btw, stateobject, )
, UDP , , , 3200 , 6400 , , , 64kb?
?