Answer the question
In order to leave comments, you need to log in
UDP Multicast Receiving data from the server without delay?
Good day!
The situation is the following.
Sending data by multicast:
socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
IPAddress ip = IPAddress.Parse(GlobalData.Address);
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip));
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, GlobalData.TTL);
IPEndPoint endPoint = new IPEndPoint(ip, GlobalData.Port);
socket.Connect(endPoint);
socket.Send(_byte, _byte.Length, SocketFlags.None);
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
endPoint = new IPEndPoint(IPAddress.Any, GlobalData.Port);
socket.Bind(endPoint);
address = IPAddress.Parse(GlobalData.Address);
socket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership,
new MulticastOption(address, IPAddress.Any));
while(true)
{
....
socket.Receive(b);
....
Thread.Sleep(1000);
}
Answer the question
In order to leave comments, you need to log in
UDP does not guarantee delivery. What has come has come.
And you already operate with the receive buffer. Perhaps you should add the send time and insert missed packets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question