locked
Using an app as a WiFi Host

    Question

  • I have an app/game in which I want several devices (both tablets & phones, I will be writing versions for both) to communicate with each other so that each player can use a separate device. This is my first time writing an app that communicates with any kind of external device, so I apologize if I am missing something. There were 3 different ideas that I initially thought of as to how to make this connection between devices:

    1. Bluetooth: I don't think this would work if there are more than 2 devices, because to the best of my knowledge, a device can only make one Bluetooth connection at a time.

    2. Windows.Devices.WiFiDirect: After looking at this for a little while, if I understand correctly, this class can also only connect to one device at a time, as stated in the remarks section at:

    http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.wifidirect.aspx

    3. Using one of the devices (obviously one of the tablets, not one of the phones) as a WiFi Host/server and having the other devices connect to it. Is this possible, and if it is, can somebody tell me where to look to find a good way to get started?

    As I said, I am new to communication between devices, so if anybody has any ideas or suggestions, they would be greatly appreciated. Thanks.


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Wednesday, November 05, 2014 2:25 AM

All replies

  • Hi Nathan, 

    I have been done few WIFI LAN application at Windows Phone connect to Windows 8

    By using UDP protocol, you can sending package at LAN.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh202864(v=vs.105).aspx

    http://metronuggets.com/2013/03/18/how-to-send-and-receive-a-udp-broadcast-in-windows-phone-8-and-win8/

    Wednesday, November 05, 2014 6:04 AM
  • I took a look at the links you sent. The first one would be great, except that (at least as far as I could tell) the Socket class is no longer available in Windows Phone 8.1. The second one is too incomplete to be helpful for me, since this is my first time using external communication between devices with any class or technology. I am looking at the StreamSocket class (http://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.sockets.streamsocket.aspx), but I can't say whether that is the right choice or not, and once again, being my first time, I will probably need help getting started. Are there any good complete examples that work with Windows Phone 8.1 and/or Windows 8.1? I will also search the code.msdn.Microsoft.com site for anything I can find. Thank you for your help.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Wednesday, November 12, 2014 10:47 PM
  • I found a (supposedly) good example at:

    https://code.msdn.microsoft.com/StreamSocket-Sample-8c573931

    I installed this app on two Windows Phones (Lumia Icon & Lumia 920) in hopes that it would do what I need to do in my app (send data of some sort, even simple text, between them). I looked like that's what it was supposed to do, but I couldn't get it to work. Maybe I don't understand the details of networking well enough, or maybe I was doing something else wrong (I didn't modify the code at all). The app is trying to use "localhost" as the Host name, and when I try to connect, it gives the error (or the message the app shows me, the app doesn't crash) that says:

    "Connect failed with error: No connection could be made because the target machine actively refused it. (Exception from HRESULT: 0x8007274D)

    I think it would be nice to have a step-by-step tutorial like the one at:

    http://msdn.microsoft.com/en-us/library/windows/apps/hh202864%28v=vs.105%29.aspx

    (but that works with Windows Phone 8.1 and Windows 8.1). I know that nobody has the time to write a tutorial that long just for me, but I'm really not sure how to start. If I knew of any books for Windows Phone 8.1 and/or Windows 8.1 and device communication, I would get them, but I'm willing to bet that all the current books are written for 8.0.

    Probably the best thing that anybody could do that would help me right now would just be step-by-step instructions to use the sample app so that I can compare what I am doing and what the app is doing during a successful app. I know I am asking a lot, but I appreciate anything that anybody can give. Thanks.


    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Friday, November 14, 2014 1:44 AM