I am using the function below inside a thread to receive the byte[] via socket. Since my machine has two network adaptors it is receiveing the byte[] two times. I want to skip the subsequent same byte[] received.
What should I do to achive this?
public void Receiver()
{
strMultpileBatchString = "";
string mcastGroup = ReceiverIP;
string port = ReceiverPort;
//Declare the socket object.
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
//Initialize the end point of the receiver socket.
IPEndPoint ipep = new IPEndPoint(IPAddress.Any, int.Parse(port));
s.SetSocketOption(SocketOptionLevel.Udp, SocketOptionName.NoDelay, 1);
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
s.Bind(ipep);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 0);
IPAddress ip = IPAddress.Parse(mcastGroup);
s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(ip));
while (true)
{
byte[] b = new byte[BytesSize];
}
}