Wi-Fi Direct UWP timeouts (Exception from HRESULT: 0x800705B4)
Asked Answered
I

1

7

I'm starting a Wi-Fi Direct access point service using the UWP APIs. It starts OK. I'm using WiFiDirectConnectionListener to monitor for devices that get connected to the access point using the ConnectionRequested event.

var connectionRequest = args.GetConnectionRequest();
var deviceInformation = connectionRequest.DeviceInformation;

// FromIdAsync needs to be called from the UI thread (in MS example).
var isConnected = RunOnUIThreadAsync(() =>
{
    try
    {
        var device = WiFiDirectDevice.FromIdAsync(deviceInformation.Id).AsTask().Result;
        if (device != null)
        {
            device.ConnectionStatusChanged -= OnDeviceConnectionStatusChanged;
            device.ConnectionStatusChanged += OnDeviceConnectionStatusChanged;

            return true;
        }

        return false;
    }
    catch (Exception e)
    {
        // This throws an Exception from HRESULT: 0x800705B4.
        return false;
    }
}).Result; 

On some devices that get connected to the access point, an exception is thrown on calling FromIdAsync with

This operation returned because the timeout period expired. (Exception from HRESULT: 0x800705B4).

In turn, the device that tries to the access point will not connect.

It's always the same devices that are unable to connect, while others connect just fine. I've tried with and without UI thread but the result remains the same. Am I using this wrong, or is this a bug in Wi-Fi Direct? If so, is there another way to start a Wi-Fi Direct access point without the UWP APIs? Perhaps that's working better.

Italia answered 5/4, 2019 at 14:54 Comment(11)
Have you tried use await async key word to replace AsTask().Result?Boles
Yes, that didn't help and ended up with the same problem.Italia
Thanks for the info @NicoZhu-MSFT, would that require an update of Windows or a code change / workaround? It would be nice if there's some way to get this to work reliably.Italia
@NicoZhu-MSFT I've noticed you've removed your message about the issue report. Any update on this (seeing as you're the only one that responded)?Italia
I have discussed with related member, Please check if your device support wdf capability.Boles
@NicoZhu-MSFT It is supported and it only happens for some devices that try to connect (others work fine). The devices are always the same. I've looked a little into it with Wireshark and there aren't any DHCP offers sent to these faulty devices either (the DHCP discover/requests are received on machine that started the access point). For the working devices I see offers being sent. This makes me think the UWP APIs are relying too much on DHCP. Any update or workaround for this would be appreciated.Italia
Anything on this @NicoZhu-MSFT? I've been further experimenting with it and if you try to connect a device with a static IP address (I'm only using legacy settings to start the AP) this exception is always thrown. It's useless like this so any workaround would be appreciated.Italia
Sorry for my delay, I tested with official code sample , and it also does not connect stably. I will ask product team for help.Boles
Thanks, that sounds good, I'm looking forward to that.Italia
@NicoZhu-MSFT Have you found anything out? This is a complete breaker for me so any workarounds would be appreciated.Italia
@NicoZhu-MSFT Anything on this? Still running into this problem...Italia
C
0

The workaround to prevent timeout is to have DHCP activated on the client side. I have had this error when trying to connect devices with fixed IP address to the hotspot.

Comfort answered 19/3, 2022 at 19:43 Comment(2)
This doesn't work reliably, already tried.Italia
Well, it did work on our devices that weren t connecting correctly. What about setting an address in 192.168.137.X (hotspot uses 192.168.137.1 by default)Comfort

© 2022 - 2024 — McMap. All rights reserved.