DatagramSocket cannot receive data from UdpClient RRS feed

  • Question

  • I am making an Win RT app that connects to a desktop app and they start to communicate in UDP and TCP.

    I have successfully implemented TCP communication in that I can send from Win RT to Desktop and send from Desktop to Win RT. using StreamSocket on Win RT and TcpListener on desktop.

    I also made it to send Udp data from Win RT to desktop without any problem. But I can't receive data's sent from desktop to Win RT. I use the following code and I don't see any problem with that but there must something.

        var g = new DatagramSocket();
        g.MessageReceived += g_MessageReceived;
        g.BindEndpointAsync(new HostName(""), "6700");
        void g_MessageReceived(DatagramSocket sender, DatagramSocketMessageReceivedEventArgs args)
        { // <- break point here.

    That break point never stops the code which means it never gets a message. I can only think of IBuffer because on my StreamSocket I should get the bytes by reader.GetBuffers() and not reader.GetBytes(). However that's the thing I need to think about on the Win RT and not Desktop. because on Tcp I just send bytes and I get buffers in Win RT so the same should happen for DatagramSocket as well.

    • reader = DataReader

    Thank you guys.


    Thursday, December 6, 2012 5:47 PM