locked
JoinMulticastGroup does not work properly RRS feed

  • Question

  • I am implementing a SSDP control-point in Metro with below code:

    	DatagramSocket socket1;
    
            public async Task listenForDevices()
            {
                socket1 = new DatagramSocket();
                socket1.MessageReceived += async (sender, args) =>
                                                    {
                                                        Debug.WriteLine("Received data" + DateTime.Now);
                                                    };
                await socket1.BindEndpointAsync(null,"");
                HostName hostName = new HostName("239.255.255.250");
                socket1.JoinMulticastGroup(hostName);
            }

    But the MessageRecived event is never triggered - I can capture data package sent to 239.255.255.250 (port 1900) by SmartSniff.

    I also tried to add await socket1.BindServiceNameAsync("1900") but the problem remains. 

    Any solutions? Thanks.


    • Edited by Vastheaven Friday, January 25, 2013 6:32 AM
    Friday, January 25, 2013 3:50 AM

All replies

  • Anybody can help me ? thanks!
    Monday, January 28, 2013 1:50 AM
  • Hello,
     
    I will involve more experts to investigate it.
     
    Best regards,
    Jesse

    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 28, 2013 9:59 AM
  • Hi,

    I think you are running in to a problem with reusesocket problem. Please check if something isn't already running on port 1900.

    - Ashish [MSFT]


    Ashish Sahu [MSFT]

    Wednesday, February 6, 2013 7:58 PM
  • HI Ashish,

    I am not binding 1900 on local, This program just listens on 1900 from ssdp multicast addresses(239.255.255.250).

    Thanks anyway.

    Thursday, February 7, 2013 3:02 AM
  • Please correct me if I'm wrong but you can not receive any packets on a port unless you are listening on that port - which I was referring to as binding. Since you can see the packets coming to port 1900 using SmartSniff, it only means that you app couldn't get to listen on that port and as a result MessageReceived never fires.

    SSDPSRV service occupies this port on Windows 8 system which means your app cannot listen to any messages sent to that port unless you stop that service and then run your app.

    - Ashish [MSFT]


    Ashish Sahu [MSFT]

    Thursday, February 7, 2013 4:12 PM
  • Please correct me if I'm wrong but you can not receive any packets on a port unless you are listening on that port - which I was referring to as binding. Since you can see the packets coming to port 1900 using SmartSniff, it only means that you app couldn't get to listen on that port and as a result MessageReceived never fires.

    SSDPSRV service occupies this port on Windows 8 system which means your app cannot listen to any messages sent to that port unless you stop that service and then run your app.

    - Ashish [MSFT]


    Ashish Sahu [MSFT]

    Thanks. But I have another desktop application (called cling workbench) which can receive SSDP packets. I believe it also listens to 1900.

    Cheers,

    Saturday, February 16, 2013 9:22 AM
  • I had a similar problem (building a universal app for RT8.1 / WP8.1). Turned out that I needed to enable "Private Networks (client & server)" in the Capabilites of the Package.appmanifest. After this I started to receive events!

    Wednesday, October 29, 2014 10:50 PM