I am Trying to create a udp server which receives data from many clients. When i try to get remote end point of client after receiving data in server from SocketAsyncEventArgs.RemoteEndpoint property... it retruns null. But all the messages are transfered correctly. I am testing this in my local pc.
Here is my Server sided code:
static Socket FlashUDP = new Socket(AddressFamily.InterNetworkV6,
SocketType.Dgram, ProtocolType.Udp);
static IPEndPoint rec_ipep = new IPEndPoint(IPAddress.Parse("fe80:0:0:0:e8dd:
c141:d9ab:80f3%12"), 14086);
static SocketAsyncEventArgs Sock_Args = new SocketAsyncEventArgs();
static byte[] dataHolder = new byte[8];
static void Main2(string[] args)
{
Sock_Args.Completed += Sock_Args_Completed;
Sock_Args.SetBuffer(dataHolder, 0, 4);
FlashUDP.Bind(rec_ipep as EndPoint);
Console.WriteLine("Reciving.. v2");
FlashUDP.ReceiveAsync(Sock_Args);
}
private static void Sock_Args_Completed(object sender, SocketAsyncEventArgs e)
{
if(e.RemoteEndPoint == null)
{
Console.WriteLine("Remote end point is null");
}
}
/* Output:
Reciving.. v2
Remote end point is null*/
Is this a bug or are there other ways to do the same thing? Thanks!