No incoming UDP traffic

Discussion in 'Site Programming, Development and Design' started by gunsh, Aug 29, 2013.

  1. I've seen this thread (Unable to send UDP Packet - but I am trying to do the "opposite". I have uploaded a simple WCF service which works fine. Now I wanted to add a simple test where I'd listen for incoming UDP traffic. Please note I have enabled "full trust".

    I tried binding to "any" address as well as my current public IP address (resolved dynamically) with a system allocated port but I never receive any UDP packet. I have tried two outgoing ISPs, turned off local PC firewall...

    Is there anything else I can do to enable incoming UDP traffic? Is this possible at all? Perhaps your policies/firewall allow outgoing but no incoming UDP. Please let me know.

    Some C# code:

    private readonly UdpClient _udp = new UdpClient(0, AddressFamily.InterNetwork);


    _udp.BeginReceive(ReceiveCallback, null);
    Log("Start! - {0} - {1}", _udp.Client.LocalEndPoint.ToString(), GetIp());

    ...the callback...

    private void ReceiveCallback(IAsyncResult ar)
    IPEndPoint remoteIp = null;
    var data = _udp.EndReceive(ar, ref remoteIp);
    Log("ReceiveCallback: {0}", remoteIp.ToString());

    _udp.BeginSend(new byte[1], 1, remoteIp, null, null);
    _udp.BeginReceive(ReceiveCallback, null);
    Last edited by a moderator: Oct 14, 2015

Share This Page