The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Developing Universal Windows apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

 none
[uap] How to communicate UAP from pc to mobile which both connected to my network wireless ( through router ) ? RRS feed

  • Question

  • My task

    My PC connected to my WI-FI router.

    My Phone connected to the same WI-FI router.

    I want create one app.

    Run it on PC.

    Run the same app on mobile.

    Press on mobile - find PC.

    And after that use them to my task.

    I need to scan all devices connected to my router.

    But it is not easy as I understand.

    Maybe someone knows another idea or has working example ?




    • Edited by SmartWhy Friday, December 2, 2016 11:19 AM
    Friday, December 2, 2016 11:18 AM

Answers

  • For scanning, datagram sockets are the way to go.

    You bind a datagram socket to the same multicast port on both PC and mobile, and every one in a while you broadcast a message to the port. Because it is a multicast message, every device on the network will get the message.

    When you get a message on a multicast port, the datagram socket's MessageRecieved event handler will trigger. This will allow your reciever to send a message back to the sender and thus respond to the multicast.

    this is called SSDP. You can learn more from this link.

    https://en.wikipedia.org/wiki/Simple_Service_Discovery_Protocol

    https://github.com/Yortw/RSSDP


    • Edited by mcosmin Friday, December 2, 2016 11:56 AM
    • Marked as answer by SmartWhy Monday, December 5, 2016 10:00 AM
    Friday, December 2, 2016 11:55 AM