Salut icon indicating copy to clipboard operation
Salut copied to clipboard

WiFi connection required for discovery?

Open danielrearden opened this issue 8 years ago • 9 comments

I created a simple app using the code in the readme to try out the library. It works great and I'm able to send messages between my two devices. However, I noticed the service discovery only works when the host device is connected to a WiFi network.

It doesn't matter if the client device is connected to the same network, a different one, or not at all. However, when the host device isn't connected to some network, it's not discoverable by the client device (even though WiFi is still turned on!). In either case, I receive a "successfully created service" message but it's like the host is not advertising the service unless it's connected to an existing WiFi network.

I have not used WiFi Direct outside of this library, so I'm not sure what the expected behavior is but I thought the API is supposed to allow devices to connect even without an access point.

Any advice on this would be greatly appreciated!

danielrearden avatar Nov 29 '16 07:11 danielrearden

I ended up not using Salut, but I've just encountered this in my own WifiP2p implementation. It seems to only affect some devices. The Nexus 4 works without being connected to WiFi, but the Galaxy S5 I'm using seems to require a WiFi connection to properly establish a group. The interesting thing is that the other device will still connect to it, but it can never get a groupOwnerAddress unless the S5 is on a WiFi network.

relevante avatar Jan 18 '17 13:01 relevante

Interesting. Try connecting without using groups.

On Jan 18, 2017 7:00 AM, "relevante" [email protected] wrote:

I ended up not using Salut, but I've just encountered this in my own WifiP2p implementation. It seems to only affect some devices. The Nexus 4 works without being connected to WiFi, but the Galaxy S5 I'm using seems to require a WiFi connection to properly establish a group. The interesting thing is that the other device will still connect to it, but it can never get a groupOwnerAddress unless the S5 is on a WiFi network.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/markrjr/Salut/issues/19#issuecomment-273469127, or mute the thread https://github.com/notifications/unsubscribe-auth/AC37HT4009ibzTHrjAjiY3qriGli-xvgks5rTgzhgaJpZM4K-pYh .

neatorobito avatar Jan 18 '17 15:01 neatorobito

Thanks! That seems to fix it.

relevante avatar Jan 18 '17 15:01 relevante

How did you connect without using groups?

Thanks,

Mark Raymond Jr.

On Jan 18, 2017, at 9:55 AM, relevante [email protected] wrote:

Thanks! That seems to fix it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/markrjr/Salut/issues/19#issuecomment-273514469, or mute the thread https://github.com/notifications/unsubscribe-auth/AC37HTVxrzumKW4vYrpdG4iEjlITsrHFks5rTjXYgaJpZM4K-pYh.

neatorobito avatar Jan 18 '17 18:01 neatorobito

I'm just connecting to a device that I get in the WIFI_P2P_PEERS_CHANGED_ACTION intent after starting peer discovery. It seems that a group is created automatically though, as I'm getting its info and removing it to disconnect. But somehow me not explicitly creating it in advance appears to have fixed the initial problem. I'm not 100% sure as there's a enough flakiness in the overall system that it's hard to be completely certain, but it seems to be working well now, at least on these phones.

relevante avatar Jan 18 '17 18:01 relevante

Huh, interesting. WiFi Direct in Android is quite flaky. I will probably implement the change in Salut as well. Thanks for the info!

neatorobito avatar Jan 18 '17 18:01 neatorobito

Sure thing, I'll let you know if anything becomes clearer as I proceed.

relevante avatar Jan 18 '17 18:01 relevante

The log says I successfully received a message, but the message is not being parsed. Used every code the way you described. yet no remedy. onDataReceived(Object o) {} is never getting executed !

ManasviniGanesh avatar Apr 24 '17 14:04 ManasviniGanesh

@ManasviniGanesh for me, sometimes it works sometime no... have you found a solution please?

abselt avatar Apr 25 '17 11:04 abselt